-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
P4ADEV-445 userInfo controller2service (#20)
- Loading branch information
1 parent
6bc7761
commit 122b7c5
Showing
10 changed files
with
149 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/it/gov/pagopa/payhub/auth/exception/custom/InvalidAccessTokenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package it.gov.pagopa.payhub.auth.exception.custom; | ||
|
||
public class InvalidAccessTokenException extends RuntimeException { | ||
public InvalidAccessTokenException(String message) { | ||
super(message); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/main/java/it/gov/pagopa/payhub/auth/service/AuthService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package it.gov.pagopa.payhub.auth.service; | ||
|
||
import it.gov.pagopa.payhub.model.generated.AccessToken; | ||
import it.gov.pagopa.payhub.model.generated.UserInfo; | ||
|
||
public interface AuthService { | ||
|
||
AccessToken postToken(String clientId, String grantType, String subjectToken, String subjectIssuer, String subjectTokenType, String scope); | ||
UserInfo getUserInfo(String accessToken); | ||
} |
11 changes: 10 additions & 1 deletion
11
src/main/java/it/gov/pagopa/payhub/auth/service/AuthServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
package it.gov.pagopa.payhub.auth.service; | ||
|
||
import it.gov.pagopa.payhub.auth.service.exchange.ExchangeTokenService; | ||
import it.gov.pagopa.payhub.auth.service.user.UserService; | ||
import it.gov.pagopa.payhub.model.generated.AccessToken; | ||
import it.gov.pagopa.payhub.model.generated.UserInfo; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Slf4j | ||
@Service | ||
public class AuthServiceImpl implements AuthService{ | ||
private final ExchangeTokenService exchangeTokenService; | ||
private final UserService userService; | ||
|
||
public AuthServiceImpl(ExchangeTokenService exchangeTokenService) { | ||
public AuthServiceImpl(ExchangeTokenService exchangeTokenService, UserService userService) { | ||
this.exchangeTokenService = exchangeTokenService; | ||
this.userService = userService; | ||
} | ||
|
||
@Override | ||
public AccessToken postToken(String clientId, String grantType, String subjectToken, String subjectIssuer, String subjectTokenType, String scope) { | ||
return exchangeTokenService.postToken(clientId, grantType, subjectToken, subjectIssuer, subjectTokenType, scope); | ||
} | ||
|
||
@Override | ||
public UserInfo getUserInfo(String accessToken) { | ||
return userService.getUserInfo(accessToken); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/it/gov/pagopa/payhub/auth/service/user/UserService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package it.gov.pagopa.payhub.auth.service.user; | ||
|
||
import it.gov.pagopa.payhub.model.generated.UserInfo; | ||
|
||
public interface UserService { | ||
UserInfo getUserInfo(String accessToken); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/it/gov/pagopa/payhub/auth/service/user/UserServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package it.gov.pagopa.payhub.auth.service.user; | ||
|
||
import it.gov.pagopa.payhub.model.generated.UserInfo; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class UserServiceImpl implements UserService{ | ||
@Override | ||
public UserInfo getUserInfo(String accessToken) { | ||
return null; //TODO | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters