Skip to content

Commit

Permalink
Add Header, Fixed a login error on the backend.
Browse files Browse the repository at this point in the history
Signed-off-by: Han Kyuhyun <[email protected]>
Co-authored-by: Jongmin Lee <[email protected]>
Co-authored-by: June Saehwan <[email protected]>
Co-authored-by: ByunJeongHeum <[email protected]>
  • Loading branch information
4 people committed Sep 9, 2023
1 parent 19f3cda commit c1080d4
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 26 deletions.
6 changes: 3 additions & 3 deletions frontend/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
REACT_APP_GOOGLE_REST_API_KEY={type_your_key}
REACT_APP_NAVER_REST_API_KEY={type_your_key}
REACT_APP_KAKAO_REST_API_KEY={type_your_key}
REACT_APP_GOOGLE_REST_API_KEY=
REACT_APP_NAVER_REST_API_KEY=
REACT_APP_KAKAO_REST_API_KEY=
8 changes: 8 additions & 0 deletions src/main/java/com/lpvs/auth/MemberProfile.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.auth;

import com.lpvs.entity.LPVSMember;
Expand All @@ -19,4 +26,5 @@ public LPVSMember toMember() {
.provider(provider)
.build();
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.auth;

import org.springframework.security.core.Authentication;
Expand Down Expand Up @@ -27,4 +34,5 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
.queryParam("refreshToken", "refreshToken")
.build().encode(StandardCharsets.UTF_8).toUriString());
}

}
8 changes: 8 additions & 0 deletions src/main/java/com/lpvs/auth/OAuthAttributes.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.auth;

import java.util.Arrays;
Expand Down Expand Up @@ -46,4 +53,5 @@ public static MemberProfile extract(String registrationId, Map<String, Object> a
.orElseThrow(IllegalArgumentException::new)
.of.apply(attributes);
}

}
7 changes: 7 additions & 0 deletions src/main/java/com/lpvs/auth/OAuthService.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.auth;

import com.lpvs.entity.LPVSMember;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/lpvs/auth/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.auth;

import lombok.RequiredArgsConstructor;
Expand Down
20 changes: 8 additions & 12 deletions src/main/java/com/lpvs/controller/LPVSWebController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.lpvs.repository.LPVSLicenseRepository;
import com.lpvs.repository.LPVSMemberRepository;
import com.lpvs.repository.LPVSPullRequestRepository;
import com.lpvs.service.LoginCheckService;
import com.lpvs.service.LPVSLoginCheckService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
Expand All @@ -16,39 +16,35 @@
@Controller
@Slf4j
public class LPVSWebController {

private LPVSMemberRepository memberRepository;
private LPVSDetectedLicenseRepository detectedLicenseRepository;
private LPVSPullRequestRepository lpvsPullRequestRepository;
private LPVSLicenseRepository licenseRepository;
private LoginCheckService loginCheckService;
private LPVSLoginCheckService LPVSLoginCheckService;

public LPVSWebController(LPVSMemberRepository memberRepository, LPVSDetectedLicenseRepository detectedLicenseRepository,
LPVSPullRequestRepository lpvsPullRequestRepository, LPVSLicenseRepository licenseRepository,
LoginCheckService loginCheckService) {
LPVSLoginCheckService LPVSLoginCheckService) {
this.memberRepository = memberRepository;
this.detectedLicenseRepository = detectedLicenseRepository;
this.lpvsPullRequestRepository = lpvsPullRequestRepository;
this.licenseRepository = licenseRepository;
this.loginCheckService = loginCheckService;
this.LPVSLoginCheckService = LPVSLoginCheckService;
}

@GetMapping("user/info")
@ResponseBody
public LPVSMember personalInfoSettings(Authentication authentication) {

loginCheckService.loginVerification(authentication);

return loginCheckService.getMemberFromMemberMap(authentication);
LPVSLoginCheckService.loginVerification(authentication);
return LPVSLoginCheckService.getMemberFromMemberMap(authentication);
}


@GetMapping("login/check")
@ResponseBody
public LPVSLoginMember loginMember(Authentication authentication) {
Boolean isLoggedIn = loginCheckService.oauthLoginStatus(authentication);
Boolean isLoggedIn = LPVSLoginCheckService.oauthLoginStatus(authentication);
if (isLoggedIn) {
LPVSMember findMember = loginCheckService.getMemberFromMemberMap(authentication);
LPVSMember findMember = LPVSLoginCheckService.getMemberFromMemberMap(authentication);
return new LPVSLoginMember(isLoggedIn, findMember);
} else {
return new LPVSLoginMember(isLoggedIn, null);
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/lpvs/entity/LPVSMember.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.entity;

import lombok.Builder;
Expand All @@ -15,7 +22,7 @@ public class LPVSMember {

@Id
@GeneratedValue
@Column(name = "member_id")
@Column(name = "id")
private Long id;

@Column(name = "name", nullable = false)
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/lpvs/exception/ErrorResponse.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.exception;

import java.time.LocalDateTime;
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/lpvs/exception/LoginFailedException.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/


package com.lpvs.exception;

public class LoginFailedException extends RuntimeException {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/lpvs/exception/PageControllerAdvice.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.exception;

import lombok.extern.slf4j.Slf4j;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/lpvs/repository/LPVSMemberRepository.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.repository;

import com.lpvs.entity.LPVSMember;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright 2023 Basaeng, kyudori, hwan5180, quswjdgma83
*
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

package com.lpvs.service;

import com.lpvs.entity.LPVSMember;
Expand All @@ -13,11 +20,11 @@

@Service
@Slf4j
public class LoginCheckService {
public class LPVSLoginCheckService {
private LPVSPullRequestRepository lpvsPullRequestRepository;
private LPVSMemberRepository memberRepository;

public LoginCheckService(LPVSPullRequestRepository lpvsPullRequestRepository, LPVSMemberRepository memberRepository) {
public LPVSLoginCheckService(LPVSPullRequestRepository lpvsPullRequestRepository, LPVSMemberRepository memberRepository) {
this.lpvsPullRequestRepository = lpvsPullRequestRepository;
this.memberRepository = memberRepository;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ license_conflict=db

# GitHub settings
# Corresponding env. variable LPVS_GITHUB_LOGIN
github.login=Basaeng
github.login=
# Corresponding env. variable LPVS_GITHUB_TOKEN
github.token=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
github.token=
# Corresponding env. variable LPVS_GITHUB_API_URL
github.api.url=https://api.github.com
# Corresponding env. variable LPVS_GITHUB_SECRET
Expand All @@ -39,8 +39,8 @@ spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/lpvs
spring.datasource.username=username
spring.datasource.password=password
spring.datasource.username=
spring.datasource.password=

# Custom DB components name configuration
app.table.detectedLicenseName=detected_license
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/database_dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,17 @@ CREATE TABLE `queue` (
-- Table structure for table `LPVSMember`
--

DROP TABLE IF EXISTS `LPVSMember`;
DROP TABLE IF EXISTS `member`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `LPVSMember` (
CREATE TABLE `member` (
`id` bigint(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
`e-mail` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`nickname` varchar(255) DEFAULT NULL,
`provider` varchar(10) NOT NULL,
`organization` varchar(255) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;


Expand Down

0 comments on commit c1080d4

Please sign in to comment.