v 3.3.0
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.authz.oauth2.provider.code;
|
||||
|
||||
import org.maxkey.constants.ConstantsPersistence;
|
||||
import org.maxkey.constants.ConstsPersistence;
|
||||
import org.maxkey.persistence.redis.RedisConnectionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -31,13 +31,13 @@ public class AuthorizationCodeServicesFactory {
|
||||
JdbcTemplate jdbcTemplate,
|
||||
RedisConnectionFactory redisConnFactory) {
|
||||
AuthorizationCodeServices authorizationCodeServices = null;
|
||||
if (persistence == ConstantsPersistence.INMEMORY) {
|
||||
if (persistence == ConstsPersistence.INMEMORY) {
|
||||
authorizationCodeServices = new InMemoryAuthorizationCodeServices();
|
||||
_logger.debug("InMemoryAuthorizationCodeServices");
|
||||
} else if (persistence == ConstantsPersistence.JDBC) {
|
||||
} else if (persistence == ConstsPersistence.JDBC) {
|
||||
//authorizationCodeServices = new JdbcAuthorizationCodeServices(jdbcTemplate);
|
||||
_logger.debug("JdbcAuthorizationCodeServices not support ");
|
||||
} else if (persistence == ConstantsPersistence.REDIS) {
|
||||
} else if (persistence == ConstsPersistence.REDIS) {
|
||||
authorizationCodeServices = new RedisAuthorizationCodeServices(redisConnFactory);
|
||||
_logger.debug("RedisAuthorizationCodeServices");
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.maxkey.authz.oauth2.provider.OAuth2RequestFactory;
|
||||
import org.maxkey.authz.oauth2.provider.TokenRequest;
|
||||
import org.maxkey.authz.oauth2.provider.token.AbstractTokenGranter;
|
||||
import org.maxkey.authz.oauth2.provider.token.AuthorizationServerTokenServices;
|
||||
import org.maxkey.constants.ConstantsProtocols;
|
||||
import org.maxkey.constants.ConstsProtocols;
|
||||
import org.maxkey.crypto.DigestUtils;
|
||||
import org.maxkey.entity.apps.oauth2.provider.ClientDetails;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@@ -124,7 +124,7 @@ public class AuthorizationCodeTokenGranter extends AbstractTokenGranter {
|
||||
//OAuth 2.1 and PKCE Support
|
||||
logger.debug("client Protocol "+client.getProtocol()+", PKCE Support "+
|
||||
(client.getPkce().equalsIgnoreCase(OAuth2Constants.PKCE_TYPE.PKCE_TYPE_YES)));
|
||||
if(client.getProtocol().equalsIgnoreCase(ConstantsProtocols.OAUTH21)
|
||||
if(client.getProtocol().equalsIgnoreCase(ConstsProtocols.OAUTH21)
|
||||
|| client.getPkce().equalsIgnoreCase(OAuth2Constants.PKCE_TYPE.PKCE_TYPE_YES)) {
|
||||
logger.trace("stored CodeChallengeMethod "+ pendingOAuth2Request.getCodeChallengeMethod());
|
||||
logger.trace("stored CodeChallenge "+ pendingOAuth2Request.getCodeChallenge());
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package org.maxkey.authz.oauth2.provider.token.store;
|
||||
|
||||
import org.maxkey.authz.oauth2.provider.token.TokenStore;
|
||||
import org.maxkey.constants.ConstantsPersistence;
|
||||
import org.maxkey.constants.ConstsPersistence;
|
||||
import org.maxkey.persistence.redis.RedisConnectionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -32,13 +32,13 @@ public class TokenStoreFactory {
|
||||
JdbcTemplate jdbcTemplate,
|
||||
RedisConnectionFactory redisConnFactory) {
|
||||
TokenStore tokenStore = null;
|
||||
if (persistence == ConstantsPersistence.INMEMORY) {
|
||||
if (persistence == ConstsPersistence.INMEMORY) {
|
||||
tokenStore = new InMemoryTokenStore();
|
||||
_logger.debug("InMemoryTokenStore");
|
||||
} else if (persistence == ConstantsPersistence.JDBC) {
|
||||
} else if (persistence == ConstsPersistence.JDBC) {
|
||||
//tokenStore = new JdbcTokenStore(jdbcTemplate);
|
||||
_logger.debug("JdbcTokenStore not support ");
|
||||
} else if (persistence == ConstantsPersistence.REDIS) {
|
||||
} else if (persistence == ConstsPersistence.REDIS) {
|
||||
tokenStore = new RedisTokenStore(redisConnFactory);
|
||||
_logger.debug("RedisTokenStore");
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public class OAuthDefaultUserInfoAdapter extends AbstractAuthorizeAdapter {
|
||||
beanMap.put("title", userInfo.getJobTitle());
|
||||
beanMap.put("state", userInfo.getWorkRegion());
|
||||
beanMap.put("gender", userInfo.getGender());
|
||||
beanMap.put("institution", userInfo.getInstId());
|
||||
beanMap.put(WebConstants.ONLINE_TICKET_NAME, authentication.getOnlineTicket().getTicketId());
|
||||
|
||||
String info= JsonUtils.object2Json(beanMap);
|
||||
|
||||
@@ -137,6 +137,7 @@ public class OpenIdConnectUserInfoEndpoint {
|
||||
SigninPrincipal authentication = (SigninPrincipal)oAuth2Authentication.getUserAuthentication().getPrincipal();
|
||||
|
||||
jwtClaimsSetBuilder.claim("sub", userInfo.getId());
|
||||
jwtClaimsSetBuilder.claim("institution", userInfo.getInstId());
|
||||
jwtClaimsSetBuilder.claim(WebConstants.ONLINE_TICKET_NAME, authentication.getOnlineTicket().getTicketId());
|
||||
|
||||
if(scopes.contains("profile")){
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.maxkey.authz.oauth2.common.exceptions.OAuth2Exception;
|
||||
import org.maxkey.authz.oauth2.provider.ClientDetailsService;
|
||||
import org.maxkey.authz.oauth2.provider.OAuth2Authentication;
|
||||
import org.maxkey.authz.oauth2.provider.token.DefaultTokenServices;
|
||||
import org.maxkey.constants.Boolean;
|
||||
import org.maxkey.constants.ConstsBoolean;
|
||||
import org.maxkey.crypto.jwt.encryption.service.JwtEncryptionAndDecryptionService;
|
||||
import org.maxkey.crypto.jwt.encryption.service.impl.RecipientJwtEncryptionAndDecryptionServiceBuilder;
|
||||
import org.maxkey.crypto.jwt.signer.service.JwtSigningAndValidationService;
|
||||
@@ -132,7 +132,7 @@ public class UserInfoEndpoint {
|
||||
Apps app=appsService.get(client_id);
|
||||
|
||||
AbstractAuthorizeAdapter adapter;
|
||||
if(Boolean.isTrue(app.getIsAdapter())){
|
||||
if(ConstsBoolean.isTrue(app.getIsAdapter())){
|
||||
adapter =(AbstractAuthorizeAdapter)Instance.newInstance(app.getAdapter());
|
||||
}else{
|
||||
adapter =(AbstractAuthorizeAdapter)defaultOAuthUserInfoAdapter;
|
||||
|
||||
Reference in New Issue
Block a user