new voucher system + jdoc
This commit is contained in:
+16
-14
@@ -14,9 +14,7 @@ import com.google.common.collect.Maps;
|
||||
import de.bstly.we.oidc.model.OidcAuthorizationCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcAuthorizationCodeManager.
|
||||
*/
|
||||
@Service
|
||||
public class OidcAuthorizationCodeManager {
|
||||
@@ -27,12 +25,14 @@ public class OidcAuthorizationCodeManager {
|
||||
private final Map<String, OidcAuthorizationCode> oidcAuthorizationCodes = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientId
|
||||
* @param redirectUri
|
||||
* @param scopes
|
||||
* @param subject
|
||||
* @return
|
||||
* Creates the.
|
||||
*
|
||||
* @param clientId the client id
|
||||
* @param redirectUri the redirect uri
|
||||
* @param scopes the scopes
|
||||
* @param userId the user id
|
||||
* @param nonce the nonce
|
||||
* @return the oidc authorization code
|
||||
*/
|
||||
public OidcAuthorizationCode create(String clientId, URI redirectUri, Set<String> scopes, Long userId,
|
||||
String nonce) {
|
||||
@@ -43,17 +43,19 @@ public class OidcAuthorizationCodeManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
* Gets the by code.
|
||||
*
|
||||
* @param code the code
|
||||
* @return the by code
|
||||
*/
|
||||
public OidcAuthorizationCode getByCode(String code) {
|
||||
return oidcAuthorizationCodes.get(code);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param code
|
||||
* Removes the by code.
|
||||
*
|
||||
* @param code the code
|
||||
*/
|
||||
public void removeByCode(String code) {
|
||||
oidcAuthorizationCodes.remove(code);
|
||||
|
||||
@@ -22,9 +22,7 @@ import de.bstly.we.oidc.model.QOidcClient;
|
||||
import de.bstly.we.oidc.repository.OidcClientRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcClientManager.
|
||||
*/
|
||||
@Service
|
||||
public class OidcClientManager {
|
||||
@@ -38,10 +36,11 @@ public class OidcClientManager {
|
||||
private QOidcClient qOidcClient = QOidcClient.oidcClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientName
|
||||
* @param redirectUris
|
||||
* @return
|
||||
* Creates the client.
|
||||
*
|
||||
* @param clientName the client name
|
||||
* @param redirectUris the redirect uris
|
||||
* @return the oidc client
|
||||
*/
|
||||
public OidcClient createClient(String clientName, Set<String> redirectUris) {
|
||||
return createClient(clientName,
|
||||
@@ -52,13 +51,16 @@ public class OidcClientManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientName
|
||||
* @param clientAuthenticationMethods
|
||||
* @param authorizationGrantTypes
|
||||
* @param redirectUris
|
||||
* @param scopes
|
||||
* @return
|
||||
* Creates the client.
|
||||
*
|
||||
* @param clientName the client name
|
||||
* @param clientAuthenticationMethods the client authentication methods
|
||||
* @param authorizationGrantTypes the authorization grant types
|
||||
* @param redirectUris the redirect uris
|
||||
* @param scopes the scopes
|
||||
* @param loginUrl the login url
|
||||
* @param alwaysPermitted the always permitted
|
||||
* @return the oidc client
|
||||
*/
|
||||
public OidcClient createClient(String clientName,
|
||||
Set<OidcClientAuthenticationMethod> clientAuthenticationMethods,
|
||||
@@ -90,18 +92,20 @@ public class OidcClientManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oidcClient
|
||||
* @return
|
||||
* Update client.
|
||||
*
|
||||
* @param oidcClient the oidc client
|
||||
* @return the oidc client
|
||||
*/
|
||||
public OidcClient updateClient(OidcClient oidcClient) {
|
||||
return oidcClientRepository.save(oidcClient);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientName
|
||||
* @return
|
||||
* Creates the new secret by client name.
|
||||
*
|
||||
* @param clientName the client name
|
||||
* @return the oidc client
|
||||
*/
|
||||
public OidcClient createNewSecretByClientName(String clientName) {
|
||||
OidcClient oidcClient = getByClientName(clientName);
|
||||
@@ -113,28 +117,31 @@ public class OidcClientManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientId
|
||||
* @return
|
||||
* Gets the by client id.
|
||||
*
|
||||
* @param clientId the client id
|
||||
* @return the by client id
|
||||
*/
|
||||
public OidcClient getByClientId(String clientId) {
|
||||
return oidcClientRepository.findOne(qOidcClient.clientId.eq(clientId)).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientName
|
||||
* @return
|
||||
* Gets the by client name.
|
||||
*
|
||||
* @param clientName the client name
|
||||
* @return the by client name
|
||||
*/
|
||||
public OidcClient getByClientName(String clientName) {
|
||||
return oidcClientRepository.findOne(qOidcClient.clientName.eq(clientName)).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientId
|
||||
* @param clientSecret
|
||||
* @return
|
||||
* Gets the by client id and secret.
|
||||
*
|
||||
* @param clientId the client id
|
||||
* @param clientSecret the client secret
|
||||
* @return the by client id and secret
|
||||
*/
|
||||
public OidcClient getByClientIdAndSecret(String clientId, String clientSecret) {
|
||||
return oidcClientRepository.findOne(
|
||||
@@ -143,9 +150,9 @@ public class OidcClientManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientId
|
||||
* @return
|
||||
* Delete by client id.
|
||||
*
|
||||
* @param clientId the client id
|
||||
*/
|
||||
public void deleteByClientId(String clientId) {
|
||||
OidcClient oidcClient = getByClientId(clientId);
|
||||
@@ -155,8 +162,9 @@ public class OidcClientManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* Delete by client name.
|
||||
*
|
||||
* @param clientName the client name
|
||||
*/
|
||||
public void deleteByClientName(String clientName) {
|
||||
OidcClient oidcClient = getByClientName(clientName);
|
||||
@@ -165,12 +173,13 @@ public class OidcClientManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param page
|
||||
* @param size
|
||||
* @param sortBy
|
||||
* @param descending
|
||||
* @return
|
||||
* Gets the.
|
||||
*
|
||||
* @param page the page
|
||||
* @param size the size
|
||||
* @param sortBy the sort by
|
||||
* @param descending the descending
|
||||
* @return the page
|
||||
*/
|
||||
public Page<OidcClient> get(int page, int size, String sortBy, boolean descending) {
|
||||
Sort sort = descending ? Sort.by(sortBy).descending() : Sort.by(sortBy).ascending();
|
||||
|
||||
@@ -49,9 +49,7 @@ import de.bstly.we.oidc.model.QOidcToken;
|
||||
import de.bstly.we.oidc.repository.OidcTokenRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcTokenManager.
|
||||
*/
|
||||
@Service
|
||||
public class OidcTokenManager {
|
||||
@@ -79,6 +77,11 @@ public class OidcTokenManager {
|
||||
private SystemPropertyManager systemPropertyManager;
|
||||
private QOidcToken qOidcToken = QOidcToken.oidcToken;
|
||||
|
||||
/**
|
||||
* Inits the oidc token manager.
|
||||
*
|
||||
* @throws JOSEException the JOSE exception
|
||||
*/
|
||||
@PostConstruct
|
||||
public void initOidcTokenManager() throws JOSEException {
|
||||
RSAKey rsaJWK = null;
|
||||
@@ -100,10 +103,11 @@ public class OidcTokenManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param client
|
||||
* @param target
|
||||
* @return
|
||||
* Creates the token.
|
||||
*
|
||||
* @param client the client
|
||||
* @param userId the user id
|
||||
* @return the oidc token
|
||||
*/
|
||||
public OidcToken createToken(OidcClient client, Long userId) {
|
||||
OidcToken token = new OidcToken();
|
||||
@@ -114,14 +118,15 @@ public class OidcTokenManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param client
|
||||
* @param userId
|
||||
* @param nonce
|
||||
* @param scopes
|
||||
* @param issuer
|
||||
* @return
|
||||
* @throws JOSEException
|
||||
* Creates the token with id token.
|
||||
*
|
||||
* @param client the client
|
||||
* @param userId the user id
|
||||
* @param nonce the nonce
|
||||
* @param scopes the scopes
|
||||
* @param issuer the issuer
|
||||
* @return the oidc token
|
||||
* @throws JOSEException the JOSE exception
|
||||
*/
|
||||
public OidcToken createTokenWithIdToken(OidcClient client, Long userId, String nonce,
|
||||
Set<String> scopes, String issuer) throws JOSEException {
|
||||
@@ -161,9 +166,10 @@ public class OidcTokenManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
* Creates the user claims.
|
||||
*
|
||||
* @param user the user
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder createUserClaims(User user) {
|
||||
|
||||
@@ -219,41 +225,46 @@ public class OidcTokenManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param accessToken
|
||||
* @return
|
||||
* Gets the by access token.
|
||||
*
|
||||
* @param accessToken the access token
|
||||
* @return the by access token
|
||||
*/
|
||||
public OidcToken getByAccessToken(String accessToken) {
|
||||
return tokenRepository.findOne(qOidcToken.accessToken.eq(accessToken)).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* Gets the signer.
|
||||
*
|
||||
* @return the signer
|
||||
*/
|
||||
public JWSSigner getSigner() {
|
||||
return signer;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* Gets the verifier.
|
||||
*
|
||||
* @return the verifier
|
||||
*/
|
||||
public JWSVerifier getVerifier() {
|
||||
return verifier;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* Gets the public key.
|
||||
*
|
||||
* @return the public key
|
||||
*/
|
||||
public RSAKey getPublicKey() {
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* Gets the jwk set.
|
||||
*
|
||||
* @return the jwk set
|
||||
*/
|
||||
public JWKSet getJwkSet() {
|
||||
return jwkSet;
|
||||
|
||||
@@ -31,9 +31,7 @@ import de.bstly.we.oidc.model.OidcClientAuthenticationMethod;
|
||||
import de.bstly.we.oidc.repository.OidcClientRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OIDCClientController.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/oidc/clients")
|
||||
@@ -45,10 +43,11 @@ public class OIDCClientController extends BaseController {
|
||||
private OidcClientRepository registeredClientRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pageParameter
|
||||
* @param sizeParameter
|
||||
* @return
|
||||
* Gets the clients.
|
||||
*
|
||||
* @param pageParameter the page parameter
|
||||
* @param sizeParameter the size parameter
|
||||
* @return the clients
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@GetMapping
|
||||
@@ -59,9 +58,10 @@ public class OIDCClientController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
* Gets the.
|
||||
*
|
||||
* @param name the name
|
||||
* @return the oidc client
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@GetMapping("/{name}")
|
||||
@@ -75,9 +75,10 @@ public class OIDCClientController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clientId
|
||||
* @return
|
||||
* Gets the by client id.
|
||||
*
|
||||
* @param clientId the client id
|
||||
* @return the by client id
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@GetMapping("/id/{clientId}")
|
||||
@@ -91,9 +92,10 @@ public class OIDCClientController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oidcClientModel
|
||||
* @return
|
||||
* Creates the.
|
||||
*
|
||||
* @param oidcClientModel the oidc client model
|
||||
* @return the oidc client
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@PostMapping
|
||||
@@ -122,9 +124,10 @@ public class OIDCClientController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oAuth2ClientModel
|
||||
* @return
|
||||
* Update.
|
||||
*
|
||||
* @param client the client
|
||||
* @return the oidc client
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@PatchMapping
|
||||
@@ -146,9 +149,9 @@ public class OIDCClientController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oAuth2ClientModel
|
||||
* @return
|
||||
* Delete client.
|
||||
*
|
||||
* @param name the name
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@DeleteMapping("/{name}")
|
||||
@@ -160,9 +163,10 @@ public class OIDCClientController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oAuth2ClientModel
|
||||
* @return
|
||||
* Creates the new secret.
|
||||
*
|
||||
* @param name the name
|
||||
* @return the oidc client
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@PostMapping("/{name}/secret")
|
||||
|
||||
@@ -36,9 +36,7 @@ import de.bstly.we.oidc.model.OidcClient;
|
||||
import de.bstly.we.security.model.LocalUserDetails;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcAuthorizationController.
|
||||
*/
|
||||
@RequestMapping("/oidc/authorize")
|
||||
@RestController
|
||||
@@ -54,15 +52,18 @@ public class OidcAuthorizationController {
|
||||
private OidcAuthorizationCodeManager oidcAuthorizationCodeManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param scope
|
||||
* @param responseType
|
||||
* @param clientId
|
||||
* @param redirectUri
|
||||
* @param state
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws IOException
|
||||
* Authorization request.
|
||||
*
|
||||
* @param scope the scope
|
||||
* @param responseType the response type
|
||||
* @param clientId the client id
|
||||
* @param redirectUri the redirect uri
|
||||
* @param state the state
|
||||
* @param nonce the nonce
|
||||
* @param principal the principal
|
||||
* @param request the request
|
||||
* @param response the response
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
@GetMapping
|
||||
@@ -167,11 +168,11 @@ public class OidcAuthorizationController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param exception
|
||||
* @param httpServletResponse
|
||||
* @return
|
||||
* @throws IOException
|
||||
* Handle.
|
||||
*
|
||||
* @param exception the exception
|
||||
* @param response the response
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
@ExceptionHandler(InvalidAuthorizationRequestError.class)
|
||||
public void handle(InvalidAuthorizationRequestError exception, HttpServletResponse response)
|
||||
@@ -192,9 +193,7 @@ public class OidcAuthorizationController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class InvalidAuthorizationRequestError.
|
||||
*/
|
||||
static class InvalidAuthorizationRequestError extends RuntimeException {
|
||||
/**
|
||||
@@ -208,11 +207,12 @@ public class OidcAuthorizationController {
|
||||
private String state;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param redirectUri
|
||||
* @param errorCode
|
||||
* @param errorDescription
|
||||
* @param state
|
||||
* Instantiates a new invalid authorization request error.
|
||||
*
|
||||
* @param redirectUri the redirect uri
|
||||
* @param errorCode the error code
|
||||
* @param errorDescription the error description
|
||||
* @param state the state
|
||||
*/
|
||||
InvalidAuthorizationRequestError(URI redirectUri, OidcAuthorizationErrorCode errorCode,
|
||||
String errorDescription, String state) {
|
||||
@@ -224,48 +224,62 @@ public class OidcAuthorizationController {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the redirectUri
|
||||
* Gets the redirect uri.
|
||||
*
|
||||
* @return the redirect uri
|
||||
*/
|
||||
public URI getRedirectUri() {
|
||||
return redirectUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redirectUri the redirectUri to set
|
||||
* Sets the redirect uri.
|
||||
*
|
||||
* @param redirectUri the new redirect uri
|
||||
*/
|
||||
public void setRedirectUri(URI redirectUri) {
|
||||
this.redirectUri = redirectUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the errorCode
|
||||
* Gets the error code.
|
||||
*
|
||||
* @return the error code
|
||||
*/
|
||||
public OidcAuthorizationErrorCode getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param errorCode the errorCode to set
|
||||
* Sets the error code.
|
||||
*
|
||||
* @param errorCode the new error code
|
||||
*/
|
||||
public void setErrorCode(OidcAuthorizationErrorCode errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the errorDescription
|
||||
* Gets the error description.
|
||||
*
|
||||
* @return the error description
|
||||
*/
|
||||
public String getErrorDescription() {
|
||||
return errorDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param errorDescription the errorDescription to set
|
||||
* Sets the error description.
|
||||
*
|
||||
* @param errorDescription the new error description
|
||||
*/
|
||||
public void setErrorDescription(String errorDescription) {
|
||||
this.errorDescription = errorDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state.
|
||||
*
|
||||
* @return the state
|
||||
*/
|
||||
public String getState() {
|
||||
@@ -273,7 +287,9 @@ public class OidcAuthorizationController {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param state the state to set
|
||||
* Sets the state.
|
||||
*
|
||||
* @param state the new state
|
||||
*/
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
|
||||
@@ -22,8 +22,7 @@ import de.bstly.we.controller.support.EntityResponseStatusException;
|
||||
import de.bstly.we.oidc.model.OidcConfiguration;
|
||||
|
||||
/**
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcDiscoveryController.
|
||||
*/
|
||||
@RequestMapping("/.well-known/openid-configuration")
|
||||
@RestController
|
||||
@@ -32,6 +31,13 @@ public class OidcDiscoveryController {
|
||||
@Value("${oidc.provider.issuer:}")
|
||||
private String oidcIssuer;
|
||||
|
||||
/**
|
||||
* Gets the configuration.
|
||||
*
|
||||
* @param request the request
|
||||
* @param response the response
|
||||
* @return the configuration
|
||||
*/
|
||||
@GetMapping
|
||||
public OidcConfiguration getConfiguration(HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
@@ -13,9 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import de.bstly.we.oidc.businesslogic.OidcTokenManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcJwksController.
|
||||
*/
|
||||
@RequestMapping("/oidc/jwks")
|
||||
@RestController
|
||||
@@ -24,6 +22,11 @@ public class OidcJwksController {
|
||||
@Autowired
|
||||
private OidcTokenManager oidcTokenManager;
|
||||
|
||||
/**
|
||||
* Gets the jwks.
|
||||
*
|
||||
* @return the jwks
|
||||
*/
|
||||
@GetMapping
|
||||
public Map<String, Object> getJwks() {
|
||||
return oidcTokenManager.getJwkSet().toJSONObject();
|
||||
|
||||
@@ -44,9 +44,7 @@ import de.bstly.we.oidc.model.OidcTokenRequest;
|
||||
import de.bstly.we.oidc.model.OidcTokenResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcTokenController.
|
||||
*/
|
||||
@RequestMapping("/oidc/token")
|
||||
@RestController
|
||||
@@ -66,6 +64,15 @@ public class OidcTokenController {
|
||||
@Value("${oidc.provider.issuer:}")
|
||||
private String oidcIssuer;
|
||||
|
||||
/**
|
||||
* Gets the token.
|
||||
*
|
||||
* @param authorizationHeader the authorization header
|
||||
* @param tokenRequest the token request
|
||||
* @param request the request
|
||||
* @param response the response
|
||||
* @return the token
|
||||
*/
|
||||
@PostMapping
|
||||
public OidcTokenResponse getToken(
|
||||
// Authorization header for BASIC client authentication method
|
||||
@@ -198,11 +205,12 @@ public class OidcTokenController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param exception
|
||||
* @param httpServletResponse
|
||||
* @return
|
||||
* @throws IOException
|
||||
* Handle.
|
||||
*
|
||||
* @param exception the exception
|
||||
* @param response the response
|
||||
* @return the response entity
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
@ExceptionHandler(InvalidTokenRequestError.class)
|
||||
public ResponseEntity<String> handle(InvalidTokenRequestError exception,
|
||||
@@ -213,9 +221,7 @@ public class OidcTokenController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class InvalidTokenRequestError.
|
||||
*/
|
||||
static class InvalidTokenRequestError extends RuntimeException {
|
||||
|
||||
@@ -227,6 +233,12 @@ public class OidcTokenController {
|
||||
private OidcTokenErrorCode errorCode;
|
||||
private String errorDescription;
|
||||
|
||||
/**
|
||||
* Instantiates a new invalid token request error.
|
||||
*
|
||||
* @param errorCode the error code
|
||||
* @param errorDescription the error description
|
||||
*/
|
||||
InvalidTokenRequestError(OidcTokenErrorCode errorCode, String errorDescription) {
|
||||
super(errorDescription);
|
||||
this.errorCode = errorCode;
|
||||
@@ -234,28 +246,36 @@ public class OidcTokenController {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the errorCode
|
||||
* Gets the error code.
|
||||
*
|
||||
* @return the error code
|
||||
*/
|
||||
public OidcTokenErrorCode getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param errorCode the errorCode to set
|
||||
* Sets the error code.
|
||||
*
|
||||
* @param errorCode the new error code
|
||||
*/
|
||||
public void setErrorCode(OidcTokenErrorCode errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the errorDescription
|
||||
* Gets the error description.
|
||||
*
|
||||
* @return the error description
|
||||
*/
|
||||
public String getErrorDescription() {
|
||||
return errorDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param errorDescription the errorDescription to set
|
||||
* Sets the error description.
|
||||
*
|
||||
* @param errorDescription the new error description
|
||||
*/
|
||||
public void setErrorDescription(String errorDescription) {
|
||||
this.errorDescription = errorDescription;
|
||||
|
||||
@@ -23,9 +23,7 @@ import de.bstly.we.oidc.businesslogic.OidcTokenManager;
|
||||
import de.bstly.we.oidc.model.OidcToken;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcUserInfoController.
|
||||
*/
|
||||
@RequestMapping("/oidc/userinfo")
|
||||
@RestController
|
||||
@@ -37,9 +35,10 @@ public class OidcUserInfoController extends BaseController {
|
||||
private UserManager userManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param authorizationHeader
|
||||
* @return
|
||||
* Gets the user info.
|
||||
*
|
||||
* @param authorizationHeader the authorization header
|
||||
* @return the user info
|
||||
*/
|
||||
@RequestMapping(method = { RequestMethod.GET, RequestMethod.POST })
|
||||
public void getUserInfo(
|
||||
|
||||
@@ -9,9 +9,7 @@ import de.bstly.we.oidc.model.OidcAuthorizationGrantType;
|
||||
import de.bstly.we.oidc.model.OidcClientAuthenticationMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcClientModel.
|
||||
*/
|
||||
public class OidcClientModel {
|
||||
|
||||
@@ -24,6 +22,8 @@ public class OidcClientModel {
|
||||
private boolean alwaysPermitted;
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
@@ -31,35 +31,45 @@ public class OidcClientModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name the new name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the registeredRedirectUris
|
||||
* Gets the registered redirect uris.
|
||||
*
|
||||
* @return the registered redirect uris
|
||||
*/
|
||||
public Set<String> getRegisteredRedirectUris() {
|
||||
return registeredRedirectUris;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param registeredRedirectUris the registeredRedirectUris to set
|
||||
* Sets the registered redirect uris.
|
||||
*
|
||||
* @param registeredRedirectUris the new registered redirect uris
|
||||
*/
|
||||
public void setRegisteredRedirectUris(Set<String> registeredRedirectUris) {
|
||||
this.registeredRedirectUris = registeredRedirectUris;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clientAuthenticationMethods
|
||||
* Gets the client authentication methods.
|
||||
*
|
||||
* @return the client authentication methods
|
||||
*/
|
||||
public Set<OidcClientAuthenticationMethod> getClientAuthenticationMethods() {
|
||||
return clientAuthenticationMethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientAuthenticationMethods the clientAuthenticationMethods to set
|
||||
* Sets the client authentication methods.
|
||||
*
|
||||
* @param clientAuthenticationMethods the new client authentication methods
|
||||
*/
|
||||
public void setClientAuthenticationMethods(
|
||||
Set<OidcClientAuthenticationMethod> clientAuthenticationMethods) {
|
||||
@@ -67,14 +77,18 @@ public class OidcClientModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the authorizationGrantTypes
|
||||
* Gets the authorization grant types.
|
||||
*
|
||||
* @return the authorization grant types
|
||||
*/
|
||||
public Set<OidcAuthorizationGrantType> getAuthorizationGrantTypes() {
|
||||
return authorizationGrantTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param authorizationGrantTypes the authorizationGrantTypes to set
|
||||
* Sets the authorization grant types.
|
||||
*
|
||||
* @param authorizationGrantTypes the new authorization grant types
|
||||
*/
|
||||
public void setAuthorizationGrantTypes(
|
||||
Set<OidcAuthorizationGrantType> authorizationGrantTypes) {
|
||||
@@ -82,6 +96,8 @@ public class OidcClientModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scopes.
|
||||
*
|
||||
* @return the scopes
|
||||
*/
|
||||
public Set<String> getScopes() {
|
||||
@@ -89,35 +105,45 @@ public class OidcClientModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scopes the scopes to set
|
||||
* Sets the scopes.
|
||||
*
|
||||
* @param scopes the new scopes
|
||||
*/
|
||||
public void setScopes(Set<String> scopes) {
|
||||
this.scopes = scopes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the loginUrl
|
||||
* Gets the login url.
|
||||
*
|
||||
* @return the login url
|
||||
*/
|
||||
public String getLoginUrl() {
|
||||
return loginUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loginUrl the loginUrl to set
|
||||
* Sets the login url.
|
||||
*
|
||||
* @param loginUrl the new login url
|
||||
*/
|
||||
public void setLoginUrl(String loginUrl) {
|
||||
this.loginUrl = loginUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the alwaysPermitted
|
||||
* Checks if is always permitted.
|
||||
*
|
||||
* @return true, if is always permitted
|
||||
*/
|
||||
public boolean isAlwaysPermitted() {
|
||||
return alwaysPermitted;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param alwaysPermitted the alwaysPermitted to set
|
||||
* Sets the always permitted.
|
||||
*
|
||||
* @param alwaysPermitted the new always permitted
|
||||
*/
|
||||
public void setAlwaysPermitted(boolean alwaysPermitted) {
|
||||
this.alwaysPermitted = alwaysPermitted;
|
||||
|
||||
@@ -11,9 +11,7 @@ import java.util.Set;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcAuthorizationCode.
|
||||
*/
|
||||
public class OidcAuthorizationCode {
|
||||
|
||||
@@ -29,12 +27,13 @@ public class OidcAuthorizationCode {
|
||||
private final String nonce;
|
||||
|
||||
/**
|
||||
* @param clientId
|
||||
* @param redirectUri
|
||||
* @param scopes
|
||||
* @param code
|
||||
* @param expiry
|
||||
* @param subject
|
||||
* Instantiates a new oidc authorization code.
|
||||
*
|
||||
* @param clientId the client id
|
||||
* @param redirectUri the redirect uri
|
||||
* @param scopes the scopes
|
||||
* @param userId the user id
|
||||
* @param nonce the nonce
|
||||
*/
|
||||
public OidcAuthorizationCode(String clientId, URI redirectUri, Set<String> scopes, Long userId,
|
||||
String nonce) {
|
||||
@@ -48,20 +47,26 @@ public class OidcAuthorizationCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clientId
|
||||
* Gets the client id.
|
||||
*
|
||||
* @return the client id
|
||||
*/
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the redirectUri
|
||||
* Gets the redirect uri.
|
||||
*
|
||||
* @return the redirect uri
|
||||
*/
|
||||
public URI getRedirectUri() {
|
||||
return redirectUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scopes.
|
||||
*
|
||||
* @return the scopes
|
||||
*/
|
||||
public Set<String> getScopes() {
|
||||
@@ -69,6 +74,8 @@ public class OidcAuthorizationCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the code.
|
||||
*
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
@@ -76,6 +83,8 @@ public class OidcAuthorizationCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the expiry.
|
||||
*
|
||||
* @return the expiry
|
||||
*/
|
||||
public Instant getExpiry() {
|
||||
@@ -83,13 +92,17 @@ public class OidcAuthorizationCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userId
|
||||
* Gets the user id.
|
||||
*
|
||||
* @return the user id
|
||||
*/
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nonce.
|
||||
*
|
||||
* @return the nonce
|
||||
*/
|
||||
public String getNonce() {
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package de.bstly.we.oidc.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Enum OidcAuthorizationErrorCode.
|
||||
*/
|
||||
public enum OidcAuthorizationErrorCode {
|
||||
INVALID_REQUEST("invalid_request"), UNAUTHORIZED_CLIENT("unauthorized_client"), ACCESS_DENIED("access_denied"),
|
||||
@@ -20,10 +18,20 @@ public enum OidcAuthorizationErrorCode {
|
||||
|
||||
private final String authorizationErrorCode;
|
||||
|
||||
/**
|
||||
* Instantiates a new oidc authorization error code.
|
||||
*
|
||||
* @param authorizationErrorCode the authorization error code
|
||||
*/
|
||||
OidcAuthorizationErrorCode(String authorizationErrorCode) {
|
||||
this.authorizationErrorCode = authorizationErrorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the authorization error code.
|
||||
*
|
||||
* @return the authorization error code
|
||||
*/
|
||||
public String getAuthorizationErrorCode() {
|
||||
return authorizationErrorCode;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package de.bstly.we.oidc.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Enum OidcAuthorizationGrantType.
|
||||
*/
|
||||
public enum OidcAuthorizationGrantType {
|
||||
authorization_code, client_credentials
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package de.bstly.we.oidc.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Enum OidcAuthorizationResponseType.
|
||||
*/
|
||||
public enum OidcAuthorizationResponseType {
|
||||
code
|
||||
|
||||
@@ -20,9 +20,7 @@ import org.hibernate.annotations.LazyCollection;
|
||||
import org.hibernate.annotations.LazyCollectionOption;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcClient.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "oidc_clients")
|
||||
@@ -66,6 +64,8 @@ public class OidcClient {
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public Long getId() {
|
||||
@@ -73,63 +73,81 @@ public class OidcClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
* Sets the id.
|
||||
*
|
||||
* @param id the new id
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clientName
|
||||
* Gets the client name.
|
||||
*
|
||||
* @return the client name
|
||||
*/
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientName the clientName to set
|
||||
* Sets the client name.
|
||||
*
|
||||
* @param clientName the new client name
|
||||
*/
|
||||
public void setClientName(String clientName) {
|
||||
this.clientName = clientName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clientId
|
||||
* Gets the client id.
|
||||
*
|
||||
* @return the client id
|
||||
*/
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientId the clientId to set
|
||||
* Sets the client id.
|
||||
*
|
||||
* @param clientId the new client id
|
||||
*/
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clientSecret
|
||||
* Gets the client secret.
|
||||
*
|
||||
* @return the client secret
|
||||
*/
|
||||
public String getClientSecret() {
|
||||
return clientSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientSecret the clientSecret to set
|
||||
* Sets the client secret.
|
||||
*
|
||||
* @param clientSecret the new client secret
|
||||
*/
|
||||
public void setClientSecret(String clientSecret) {
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clientAuthenticationMethods
|
||||
* Gets the client authentication methods.
|
||||
*
|
||||
* @return the client authentication methods
|
||||
*/
|
||||
public Set<OidcClientAuthenticationMethod> getClientAuthenticationMethods() {
|
||||
return clientAuthenticationMethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientAuthenticationMethods the clientAuthenticationMethods to set
|
||||
* Sets the client authentication methods.
|
||||
*
|
||||
* @param clientAuthenticationMethods the new client authentication methods
|
||||
*/
|
||||
public void setClientAuthenticationMethods(
|
||||
Set<OidcClientAuthenticationMethod> clientAuthenticationMethods) {
|
||||
@@ -137,14 +155,18 @@ public class OidcClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the authorizationGrantTypes
|
||||
* Gets the authorization grant types.
|
||||
*
|
||||
* @return the authorization grant types
|
||||
*/
|
||||
public Set<OidcAuthorizationGrantType> getAuthorizationGrantTypes() {
|
||||
return authorizationGrantTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param authorizationGrantTypes the authorizationGrantTypes to set
|
||||
* Sets the authorization grant types.
|
||||
*
|
||||
* @param authorizationGrantTypes the new authorization grant types
|
||||
*/
|
||||
public void setAuthorizationGrantTypes(
|
||||
Set<OidcAuthorizationGrantType> authorizationGrantTypes) {
|
||||
@@ -152,20 +174,26 @@ public class OidcClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the redirectUris
|
||||
* Gets the redirect uris.
|
||||
*
|
||||
* @return the redirect uris
|
||||
*/
|
||||
public Set<String> getRedirectUris() {
|
||||
return redirectUris;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redirectUris the redirectUris to set
|
||||
* Sets the redirect uris.
|
||||
*
|
||||
* @param redirectUris the new redirect uris
|
||||
*/
|
||||
public void setRedirectUris(Set<String> redirectUris) {
|
||||
this.redirectUris = redirectUris;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scopes.
|
||||
*
|
||||
* @return the scopes
|
||||
*/
|
||||
public Set<String> getScopes() {
|
||||
@@ -173,55 +201,71 @@ public class OidcClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scopes the scopes to set
|
||||
* Sets the scopes.
|
||||
*
|
||||
* @param scopes the new scopes
|
||||
*/
|
||||
public void setScopes(Set<String> scopes) {
|
||||
this.scopes = scopes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tokenLifetime
|
||||
* Gets the token lifetime.
|
||||
*
|
||||
* @return the token lifetime
|
||||
*/
|
||||
public Long getTokenLifetime() {
|
||||
return tokenLifetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tokenLifetime the tokenLifetime to set
|
||||
* Sets the token lifetime.
|
||||
*
|
||||
* @param tokenLifetime the new token lifetime
|
||||
*/
|
||||
public void setTokenLifetime(Long tokenLifetime) {
|
||||
this.tokenLifetime = tokenLifetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the loginUrl
|
||||
* Gets the login url.
|
||||
*
|
||||
* @return the login url
|
||||
*/
|
||||
public String getLoginUrl() {
|
||||
return loginUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loginUrl the loginUrl to set
|
||||
* Sets the login url.
|
||||
*
|
||||
* @param loginUrl the new login url
|
||||
*/
|
||||
public void setLoginUrl(String loginUrl) {
|
||||
this.loginUrl = loginUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the alwaysPermitted
|
||||
* Checks if is always permitted.
|
||||
*
|
||||
* @return true, if is always permitted
|
||||
*/
|
||||
public boolean isAlwaysPermitted() {
|
||||
return alwaysPermitted;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param alwaysPermitted the alwaysPermitted to set
|
||||
* Sets the always permitted.
|
||||
*
|
||||
* @param alwaysPermitted the new always permitted
|
||||
*/
|
||||
public void setAlwaysPermitted(boolean alwaysPermitted) {
|
||||
this.alwaysPermitted = alwaysPermitted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the category.
|
||||
*
|
||||
* @return the category
|
||||
*/
|
||||
public String getCategory() {
|
||||
@@ -229,7 +273,9 @@ public class OidcClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param category the category to set
|
||||
* Sets the category.
|
||||
*
|
||||
* @param category the new category
|
||||
*/
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package de.bstly.we.oidc.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Enum OidcClientAuthenticationMethod.
|
||||
*/
|
||||
public enum OidcClientAuthenticationMethod {
|
||||
basic, post
|
||||
|
||||
@@ -7,8 +7,7 @@ import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcConfiguration.
|
||||
*/
|
||||
public class OidcConfiguration {
|
||||
|
||||
@@ -24,6 +23,8 @@ public class OidcConfiguration {
|
||||
private Set<String> token_endpoint_auth_methods_supported;
|
||||
|
||||
/**
|
||||
* Gets the issuer.
|
||||
*
|
||||
* @return the issuer
|
||||
*/
|
||||
public String getIssuer() {
|
||||
@@ -31,135 +32,171 @@ public class OidcConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param issuer the issuer to set
|
||||
* Sets the issuer.
|
||||
*
|
||||
* @param issuer the new issuer
|
||||
*/
|
||||
public void setIssuer(String issuer) {
|
||||
this.issuer = issuer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the authorization_endpoint
|
||||
* Gets the authorization endpoint.
|
||||
*
|
||||
* @return the authorization endpoint
|
||||
*/
|
||||
public URI getAuthorization_endpoint() {
|
||||
return authorization_endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param authorization_endpoint the authorization_endpoint to set
|
||||
* Sets the authorization endpoint.
|
||||
*
|
||||
* @param authorization_endpoint the new authorization endpoint
|
||||
*/
|
||||
public void setAuthorization_endpoint(URI authorization_endpoint) {
|
||||
this.authorization_endpoint = authorization_endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the token_endpoint
|
||||
* Gets the token endpoint.
|
||||
*
|
||||
* @return the token endpoint
|
||||
*/
|
||||
public URI getToken_endpoint() {
|
||||
return token_endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param token_endpoint the token_endpoint to set
|
||||
* Sets the token endpoint.
|
||||
*
|
||||
* @param token_endpoint the new token endpoint
|
||||
*/
|
||||
public void setToken_endpoint(URI token_endpoint) {
|
||||
this.token_endpoint = token_endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userinfo_endpoint
|
||||
* Gets the userinfo endpoint.
|
||||
*
|
||||
* @return the userinfo endpoint
|
||||
*/
|
||||
public URI getUserinfo_endpoint() {
|
||||
return userinfo_endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userinfo_endpoint the userinfo_endpoint to set
|
||||
* Sets the userinfo endpoint.
|
||||
*
|
||||
* @param userinfo_endpoint the new userinfo endpoint
|
||||
*/
|
||||
public void setUserinfo_endpoint(URI userinfo_endpoint) {
|
||||
this.userinfo_endpoint = userinfo_endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the jwks_uri
|
||||
* Gets the jwks uri.
|
||||
*
|
||||
* @return the jwks uri
|
||||
*/
|
||||
public URI getJwks_uri() {
|
||||
return jwks_uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jwks_uri the jwks_uri to set
|
||||
* Sets the jwks uri.
|
||||
*
|
||||
* @param jwks_uri the new jwks uri
|
||||
*/
|
||||
public void setJwks_uri(URI jwks_uri) {
|
||||
this.jwks_uri = jwks_uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scopes_supported
|
||||
* Gets the scopes supported.
|
||||
*
|
||||
* @return the scopes supported
|
||||
*/
|
||||
public Set<String> getScopes_supported() {
|
||||
return scopes_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scopes_supported the scopes_supported to set
|
||||
* Sets the scopes supported.
|
||||
*
|
||||
* @param scopes_supported the new scopes supported
|
||||
*/
|
||||
public void setScopes_supported(Set<String> scopes_supported) {
|
||||
this.scopes_supported = scopes_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the response_types_supported
|
||||
* Gets the response types supported.
|
||||
*
|
||||
* @return the response types supported
|
||||
*/
|
||||
public Set<String> getResponse_types_supported() {
|
||||
return response_types_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param response_types_supported the response_types_supported to set
|
||||
* Sets the response types supported.
|
||||
*
|
||||
* @param response_types_supported the new response types supported
|
||||
*/
|
||||
public void setResponse_types_supported(Set<String> response_types_supported) {
|
||||
this.response_types_supported = response_types_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subject_types_supported
|
||||
* Gets the subject types supported.
|
||||
*
|
||||
* @return the subject types supported
|
||||
*/
|
||||
public Set<String> getSubject_types_supported() {
|
||||
return subject_types_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param subject_types_supported the subject_types_supported to set
|
||||
* Sets the subject types supported.
|
||||
*
|
||||
* @param subject_types_supported the new subject types supported
|
||||
*/
|
||||
public void setSubject_types_supported(Set<String> subject_types_supported) {
|
||||
this.subject_types_supported = subject_types_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the grant_types_supported
|
||||
* Gets the grant types supported.
|
||||
*
|
||||
* @return the grant types supported
|
||||
*/
|
||||
public Set<String> getGrant_types_supported() {
|
||||
return grant_types_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param grant_types_supported the grant_types_supported to set
|
||||
* Sets the grant types supported.
|
||||
*
|
||||
* @param grant_types_supported the new grant types supported
|
||||
*/
|
||||
public void setGrant_types_supported(Set<String> grant_types_supported) {
|
||||
this.grant_types_supported = grant_types_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the token_endpoint_auth_methods_supported
|
||||
* Gets the token endpoint auth methods supported.
|
||||
*
|
||||
* @return the token endpoint auth methods supported
|
||||
*/
|
||||
public Set<String> getToken_endpoint_auth_methods_supported() {
|
||||
return token_endpoint_auth_methods_supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param token_endpoint_auth_methods_supported the
|
||||
* token_endpoint_auth_methods_supported
|
||||
* to set
|
||||
* Sets the token endpoint auth methods supported.
|
||||
*
|
||||
* @param token_endpoint_auth_methods_supported the new token endpoint auth methods supported
|
||||
*/
|
||||
public void setToken_endpoint_auth_methods_supported(
|
||||
Set<String> token_endpoint_auth_methods_supported) {
|
||||
|
||||
@@ -19,9 +19,7 @@ import org.hibernate.annotations.LazyCollectionOption;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcToken.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "oidc_tokens")
|
||||
@@ -49,6 +47,8 @@ public class OidcToken {
|
||||
private Set<String> scopes;
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public Long getId() {
|
||||
@@ -56,27 +56,35 @@ public class OidcToken {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
* Sets the id.
|
||||
*
|
||||
* @param id the new id
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userId
|
||||
* Gets the user id.
|
||||
*
|
||||
* @return the user id
|
||||
*/
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userId the userId to set
|
||||
* Sets the user id.
|
||||
*
|
||||
* @param userId the new user id
|
||||
*/
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the client.
|
||||
*
|
||||
* @return the client
|
||||
*/
|
||||
public Long getClient() {
|
||||
@@ -84,69 +92,89 @@ public class OidcToken {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param client the client to set
|
||||
* Sets the client.
|
||||
*
|
||||
* @param client the new client
|
||||
*/
|
||||
public void setClient(Long client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the accessToken
|
||||
* Gets the access token.
|
||||
*
|
||||
* @return the access token
|
||||
*/
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accessToken the accessToken to set
|
||||
* Sets the access token.
|
||||
*
|
||||
* @param accessToken the new access token
|
||||
*/
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the refreshToken
|
||||
* Gets the refresh token.
|
||||
*
|
||||
* @return the refresh token
|
||||
*/
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param refreshToken the refreshToken to set
|
||||
* Sets the refresh token.
|
||||
*
|
||||
* @param refreshToken the new refresh token
|
||||
*/
|
||||
public void setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the expiresIn
|
||||
* Gets the expires in.
|
||||
*
|
||||
* @return the expires in
|
||||
*/
|
||||
public Long getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param expiresIn the expiresIn to set
|
||||
* Sets the expires in.
|
||||
*
|
||||
* @param expiresIn the new expires in
|
||||
*/
|
||||
public void setExpiresIn(Long expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the idToken
|
||||
* Gets the id token.
|
||||
*
|
||||
* @return the id token
|
||||
*/
|
||||
public String getIdToken() {
|
||||
return idToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idToken the idToken to set
|
||||
* Sets the id token.
|
||||
*
|
||||
* @param idToken the new id token
|
||||
*/
|
||||
public void setIdToken(String idToken) {
|
||||
this.idToken = idToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scopes.
|
||||
*
|
||||
* @return the scopes
|
||||
*/
|
||||
public Set<String> getScopes() {
|
||||
@@ -154,7 +182,9 @@ public class OidcToken {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scopes the scopes to set
|
||||
* Sets the scopes.
|
||||
*
|
||||
* @param scopes the new scopes
|
||||
*/
|
||||
public void setScopes(Set<String> scopes) {
|
||||
this.scopes = scopes;
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package de.bstly.we.oidc.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Enum OidcTokenErrorCode.
|
||||
*/
|
||||
public enum OidcTokenErrorCode {
|
||||
INVALID_REQUEST("invalid_request"), INVALID_CLIENT("invalid_client"),
|
||||
@@ -15,10 +13,20 @@ public enum OidcTokenErrorCode {
|
||||
|
||||
private final String tokenErrorCode;
|
||||
|
||||
/**
|
||||
* Instantiates a new oidc token error code.
|
||||
*
|
||||
* @param tokenErrorCode the token error code
|
||||
*/
|
||||
OidcTokenErrorCode(String tokenErrorCode) {
|
||||
this.tokenErrorCode = tokenErrorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token error code.
|
||||
*
|
||||
* @return the token error code
|
||||
*/
|
||||
public String getTokenErrorCode() {
|
||||
return tokenErrorCode;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,7 @@ package de.bstly.we.oidc.model;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcTokenRequest.
|
||||
*/
|
||||
public class OidcTokenRequest {
|
||||
|
||||
@@ -20,12 +18,14 @@ public class OidcTokenRequest {
|
||||
private final String scope;
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* @param grant_type
|
||||
* @param client_id
|
||||
* @param client_secret
|
||||
* @param redirect_uri
|
||||
* @param scope
|
||||
* Instantiates a new oidc token request.
|
||||
*
|
||||
* @param code the code
|
||||
* @param grant_type the grant type
|
||||
* @param client_id the client id
|
||||
* @param client_secret the client secret
|
||||
* @param redirect_uri the redirect uri
|
||||
* @param scope the scope
|
||||
*/
|
||||
public OidcTokenRequest(String code, OidcAuthorizationGrantType grant_type, String client_id,
|
||||
String client_secret, URI redirect_uri, String scope) {
|
||||
@@ -39,34 +39,44 @@ public class OidcTokenRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the client_id
|
||||
* Gets the client id.
|
||||
*
|
||||
* @return the client id
|
||||
*/
|
||||
public String getClient_id() {
|
||||
return client_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param client_id the client_id to set
|
||||
* Sets the client id.
|
||||
*
|
||||
* @param client_id the new client id
|
||||
*/
|
||||
public void setClient_id(String client_id) {
|
||||
this.client_id = client_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the client_secret
|
||||
* Gets the client secret.
|
||||
*
|
||||
* @return the client secret
|
||||
*/
|
||||
public String getClient_secret() {
|
||||
return client_secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param client_secret the client_secret to set
|
||||
* Sets the client secret.
|
||||
*
|
||||
* @param client_secret the new client secret
|
||||
*/
|
||||
public void setClient_secret(String client_secret) {
|
||||
this.client_secret = client_secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the code.
|
||||
*
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
@@ -74,20 +84,26 @@ public class OidcTokenRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the grant_type
|
||||
* Gets the grant type.
|
||||
*
|
||||
* @return the grant type
|
||||
*/
|
||||
public OidcAuthorizationGrantType getGrant_type() {
|
||||
return grant_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the redirect_uri
|
||||
* Gets the redirect uri.
|
||||
*
|
||||
* @return the redirect uri
|
||||
*/
|
||||
public URI getRedirect_uri() {
|
||||
return redirect_uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scope.
|
||||
*
|
||||
* @return the scope
|
||||
*/
|
||||
public String getScope() {
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package de.bstly.we.oidc.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Class OidcTokenResponse.
|
||||
*/
|
||||
public class OidcTokenResponse {
|
||||
|
||||
@@ -17,70 +15,90 @@ public class OidcTokenResponse {
|
||||
private String id_token;
|
||||
|
||||
/**
|
||||
* @return the access_token
|
||||
* Gets the access token.
|
||||
*
|
||||
* @return the access token
|
||||
*/
|
||||
public String getAccess_token() {
|
||||
return access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param access_token the access_token to set
|
||||
* Sets the access token.
|
||||
*
|
||||
* @param access_token the new access token
|
||||
*/
|
||||
public void setAccess_token(String access_token) {
|
||||
this.access_token = access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the token_type
|
||||
* Gets the token type.
|
||||
*
|
||||
* @return the token type
|
||||
*/
|
||||
public String getToken_type() {
|
||||
return token_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param token_type the token_type to set
|
||||
* Sets the token type.
|
||||
*
|
||||
* @param token_type the new token type
|
||||
*/
|
||||
public void setToken_type(String token_type) {
|
||||
this.token_type = token_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the refresh_token
|
||||
* Gets the refresh token.
|
||||
*
|
||||
* @return the refresh token
|
||||
*/
|
||||
public String getRefresh_token() {
|
||||
return refresh_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param refresh_token the refresh_token to set
|
||||
* Sets the refresh token.
|
||||
*
|
||||
* @param refresh_token the new refresh token
|
||||
*/
|
||||
public void setRefresh_token(String refresh_token) {
|
||||
this.refresh_token = refresh_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the expires_in
|
||||
* Gets the expires in.
|
||||
*
|
||||
* @return the expires in
|
||||
*/
|
||||
public long getExpires_in() {
|
||||
return expires_in;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param expires_in the expires_in to set
|
||||
* Sets the expires in.
|
||||
*
|
||||
* @param expires_in the new expires in
|
||||
*/
|
||||
public void setExpires_in(long expires_in) {
|
||||
this.expires_in = expires_in;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id_token
|
||||
* Gets the id token.
|
||||
*
|
||||
* @return the id token
|
||||
*/
|
||||
public String getId_token() {
|
||||
return id_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id_token the id_token to set
|
||||
* Sets the id token.
|
||||
*
|
||||
* @param id_token the new id token
|
||||
*/
|
||||
public void setId_token(String id_token) {
|
||||
this.id_token = id_token;
|
||||
|
||||
@@ -10,9 +10,7 @@ import org.springframework.stereotype.Repository;
|
||||
import de.bstly.we.oidc.model.OidcClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Interface OidcClientRepository.
|
||||
*/
|
||||
@Repository
|
||||
public interface OidcClientRepository extends JpaRepository<OidcClient, Long>, QuerydslPredicateExecutor<OidcClient> {
|
||||
|
||||
@@ -10,9 +10,7 @@ import org.springframework.stereotype.Repository;
|
||||
import de.bstly.we.oidc.model.OidcToken;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author _bastler@bstly.de
|
||||
*
|
||||
* The Interface OidcTokenRepository.
|
||||
*/
|
||||
@Repository
|
||||
public interface OidcTokenRepository extends JpaRepository<OidcToken, Long>, QuerydslPredicateExecutor<OidcToken> {
|
||||
|
||||
Reference in New Issue
Block a user