shimingxy 6 سال پیش
والد
کامیت
e62f96fa73
100فایلهای تغییر یافته به همراه1310 افزوده شده و 2958 حذف شده
  1. 4 1
      .gitignore
  2. 4 3
      maxkey-client-sdk/src/main/java/org/maxkey/client/oauth/OAuthClient.java
  3. 4 3
      maxkey-client-sdk/src/main/java/org/maxkey/client/oauth/builder/api/ConnsecApi10a.java
  4. 1 1
      maxkey-client-sdk/src/main/java/org/maxkey/client/oauth/builder/api/ConnsecApi20.java
  5. 12 1
      maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java
  6. 15 2
      maxkey-core/src/main/java/org/maxkey/authn/BasicAuthentication.java
  7. 5 2
      maxkey-core/src/main/java/org/maxkey/authn/RealmAuthenticationProvider.java
  8. 3 3
      maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java
  9. 18 1
      maxkey-core/src/main/java/org/maxkey/domain/Accounts.java
  10. 18 0
      maxkey-core/src/main/java/org/maxkey/domain/LoginAppsHistory.java
  11. 19 6
      maxkey-core/src/main/java/org/maxkey/domain/LoginHistory.java
  12. 11 1
      maxkey-core/src/main/java/org/maxkey/domain/UserInfo.java
  13. 10 2
      maxkey-core/src/main/java/org/maxkey/domain/apps/Applications.java
  14. 12 1
      maxkey-core/src/main/java/org/maxkey/domain/apps/CasDetails.java
  15. 24 1
      maxkey-core/src/main/java/org/maxkey/domain/apps/FormBasedDetails.java
  16. 389 1
      maxkey-core/src/main/java/org/maxkey/domain/apps/SAML20Details.java
  17. 0 378
      maxkey-core/src/main/java/org/maxkey/domain/apps/SAMLBaseDetails.java
  18. 22 0
      maxkey-core/src/main/java/org/maxkey/domain/apps/TokenBasedDetails.java
  19. 2 0
      maxkey-core/src/main/java/org/maxkey/web/WebConstants.java
  20. 8 4
      maxkey-core/src/main/java/org/maxkey/web/WebContext.java
  21. 12 0
      maxkey-dao/.classpath
  22. 2 0
      maxkey-dao/.settings/org.eclipse.wst.common.component
  23. 3 1
      maxkey-dao/src/main/java/org/maxkey/dao/persistence/MyAppsListMapper.java
  24. 5 0
      maxkey-dao/src/main/java/org/maxkey/dao/service/MyAppsListService.java
  25. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/DesktopDetailsMapper.xml
  26. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ForgotPasswordMapper.xml
  27. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/FormBasedDetailsMapper.xml
  28. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/GroupMemberMapper.xml
  29. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/GroupsMapper.xml
  30. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/IpAddrFilterMapper.xml
  31. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/LoginAppsHistoryMapper.xml
  32. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/LoginHistoryMapper.xml
  33. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/LogsMapper.xml
  34. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/MyAppsListMapper.xml
  35. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/MyProfileMapper.xml
  36. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/NavigationsMapper.xml
  37. 0 5
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/Oauth10aDetailsMapper.xml
  38. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/OrganizationsMapper.xml
  39. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/PasswordPolicyMapper.xml
  40. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RegistrationMapper.xml
  41. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ReportMapper.xml
  42. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RoleNavMapper.xml
  43. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RoleUserMapper.xml
  44. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RolesMapper.xml
  45. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/Saml20DetailsMapper.xml
  46. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/Saml20MetadataMapper.xml
  47. 1 1
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/TokenBasedDetailsMapper.xml
  48. 91 0
      maxkey-dao/src/test/java/org/apache/mybatis/jpa/test/AccountsServiceTest.java
  49. 141 0
      maxkey-dao/src/test/java/org/apache/mybatis/jpa/test/FormBasedDetailsServiceTest.java
  50. 29 0
      maxkey-dao/src/test/resources/config/applicationConfig.properties
  51. 27 0
      maxkey-dao/src/test/resources/log4j2.xml
  52. 33 0
      maxkey-dao/src/test/resources/spring/applicationContext-database.xml
  53. 87 0
      maxkey-dao/src/test/resources/spring/applicationContext-persist.xml
  54. 47 0
      maxkey-dao/src/test/resources/spring/applicationContext.xml
  55. 76 73
      maxkey-demos/maxkey-demo-cas/src/main/webapp/WEB-INF/web.xml
  56. 1 1
      maxkey-demos/maxkey-demo-cas/src/main/webapp/index.jsp
  57. 72 0
      maxkey-demos/maxkey-demo-cas/src/main/webapp/test.html
  58. 3 3
      maxkey-demos/maxkey-demo-jwt/bin/main/jwk.jwks
  59. BIN
      maxkey-demos/maxkey-demo-jwt/lib/connsec-oidc.jar
  60. BIN
      maxkey-demos/maxkey-demo-jwt/lib/maxkey-client-sdk.jar
  61. BIN
      maxkey-demos/maxkey-demo-jwt/lib/maxkey-jose-jwt.jar
  62. BIN
      maxkey-demos/maxkey-demo-jwt/lib/nimbus-jose-jwt-3.5.jar
  63. 3 3
      maxkey-demos/maxkey-demo-jwt/src/main/resources/jwk.jwks
  64. 6 5
      maxkey-demos/maxkey-demo-jwt/src/main/webapp/jwtcallback.jsp
  65. 0 45
      maxkey-demos/maxkey-demo-oauth/src/main/webapp/oauth10aindex.jsp
  66. 1 1
      maxkey-demos/maxkey-demo-oauth/src/main/webapp/oauth20callback.jsp
  67. 1 1
      maxkey-demos/maxkey-demo-oauth/src/main/webapp/oauth20index.jsp
  68. 1 1
      maxkey-demos/maxkey-demo-oauth/src/main/webapp/oidc10callback.jsp
  69. BIN
      maxkey-lib/db/mybatis-jpa-extra-1.0.jar
  70. 12 26
      maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/AuthorizeBaseEndpoint.java
  71. 2 2
      maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/AuthorizeCredentialEndpoint.java
  72. 12 40
      maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/AuthorizeEndpoint.java
  73. 0 1
      maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/CasAuthorizeEndpoint.java
  74. 2 2
      maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/ExtendApiAuthorizeEndpoint.java
  75. 4 1
      maxkey-protocols/maxkey-protocol-ltpa/src/main/java/org/maxkey/authz/ltpa/endpoint/LtpaAuthorizeEndpoint.java
  76. 18 0
      maxkey-protocols/maxkey-protocol-oauth-2.0/json-web-key-generator/Usage.txt
  77. 2 0
      maxkey-protocols/maxkey-protocol-oauth-2.0/json-web-key-generator/json-web-key-generator.bat
  78. BIN
      maxkey-protocols/maxkey-protocol-oauth-2.0/json-web-key-generator/json-web-key-generator.jar
  79. 14 0
      maxkey-protocols/maxkey-protocol-oauth-2.0/json-web-key-generator/maxkey.jwks
  80. 0 3
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/META-INF/MANIFEST.MF
  81. 0 118
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/AbstractOAuth2Token.java
  82. 0 72
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/AuthenticationMethod.java
  83. 0 79
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/AuthorizationGrantType.java
  84. 0 153
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/ClaimAccessor.java
  85. 0 77
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/ClientAuthenticationMethod.java
  86. 0 72
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/DelegatingOAuth2TokenValidator.java
  87. 0 131
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2AccessToken.java
  88. 0 98
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2AuthenticationException.java
  89. 0 56
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2AuthorizationException.java
  90. 0 98
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2Error.java
  91. 0 95
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2ErrorCodes.java
  92. 0 45
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2RefreshToken.java
  93. 0 35
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2TokenValidator.java
  94. 0 92
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2TokenValidatorResult.java
  95. 0 222
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AccessTokenResponse.java
  96. 0 65
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationExchange.java
  97. 0 405
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequest.java
  98. 0 218
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponse.java
  99. 0 72
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseType.java
  100. 0 108
      maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2ParameterNames.java

+ 4 - 1
.gitignore

@@ -13,4 +13,7 @@ build/*
 *.log.*
 */logs/*
 */jdk/*
-jdk/*
+jdk/*
+
+*/org/apache/mybatis/jpa/*
+org/apache/mybatis/jpa/*

+ 4 - 3
maxkey-client-sdk/src/main/java/org/maxkey/client/oauth/OAuthClient.java

@@ -17,12 +17,13 @@ import org.maxkey.client.utils.Preconditions;
 public class OAuthClient {
 	
 	private   static  Log log  =  LogFactory.getLog(OAuthClient. class );
+	private static final String DEFAULT_WEB_URL = "http://sso.maxkey.org/maxkey";
 	
-	public static String OAUTH_V20_USERINFO_URI="http://login.connsec.com/maxkey/api/oauth/v20/me";
+	public static String OAUTH_V20_USERINFO_URI=DEFAULT_WEB_URL+"/api/oauth/v20/me";
 	
-	public static String OAUTH_V10A_USERINFO_URI="http://login.connsec.com/maxkey/api/oauth/v10a/me";
+	public static String OAUTH_V10A_USERINFO_URI=DEFAULT_WEB_URL+"/api/oauth/v10a/me";
 	
-	public static String OPENID_CONNECT_V10A_USERINFO_URI="http://login.connsec.com/maxkey/api/connect/v10/userinfo";
+	public static String OPENID_CONNECT_V10A_USERINFO_URI=DEFAULT_WEB_URL+"/api/connect/v10/userinfo";
 	
 	//action method
 	private HttpVerb method = HttpVerb.GET;

+ 4 - 3
maxkey-client-sdk/src/main/java/org/maxkey/client/oauth/builder/api/ConnsecApi10a.java

@@ -4,7 +4,8 @@ import org.maxkey.client.oauth.model.Token;
 
 public class ConnsecApi10a extends DefaultApi10a
 {
-  private static final String AUTHORIZATION_URL = "http://login.connsec.com/maxkey/oauth/v10a/authz?oauth_token=%s";
+	private static final String DEFAULT_WEB_URL = "http://sso.maxkey.org/maxkey";
+	private static final String AUTHORIZATION_URL = DEFAULT_WEB_URL+"/oauth/v10a/authz?oauth_token=%s";
   
   public ConnsecApi10a() {
 	  
@@ -13,13 +14,13 @@ public class ConnsecApi10a extends DefaultApi10a
 @Override
   public String getAccessTokenEndpoint()
   {
-    return "http://login.connsec.com/maxkey/oauth/v10a/access_token";
+    return DEFAULT_WEB_URL+"/oauth/v10a/access_token";
   }
 
   @Override
   public String getRequestTokenEndpoint()
   {
-    return "http://login.connsec.com/maxkey/oauth/v10a/request_token";
+    return DEFAULT_WEB_URL+"/oauth/v10a/request_token";
   }
   
   @Override

+ 1 - 1
maxkey-client-sdk/src/main/java/org/maxkey/client/oauth/builder/api/ConnsecApi20.java

@@ -9,7 +9,7 @@ import org.maxkey.client.utils.Preconditions;
 
 public class ConnsecApi20 extends DefaultApi20 {
 	//approval_prompt:force or auto
-	private static final String DEFAULT_WEB_URL = "http://login.connsec.com/maxkey";
+	private static final String DEFAULT_WEB_URL = "http://sso.maxkey.org/maxkey";
 	
 	private static final String AUTHORIZATION_URL = "%s/oauth/v20/authorize?client_id=%s&response_type=code&redirect_uri=%s&approval_prompt=auto";
     

+ 12 - 1
maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java

@@ -80,12 +80,23 @@ public abstract class AbstractAuthenticationProvider{
         }
         
         // user authenticated
-        _logger.debug("'{0}' authenticated successfully by {}.", authentication.getPrincipal(), getProviderName());
+        _logger.debug("'{}' authenticated successfully by {}.", authentication.getPrincipal(), getProviderName());
         
         UserInfo userInfo=WebContext.getUserInfo();
+        Object password_set_type=WebContext.getSession().getAttribute(WebConstants.CURRENT_LOGIN_USER_PASSWORD_SET_TYPE);
+        //登录完成后切换SESSION
+        _logger.debug("Login  Session {}.", WebContext.getSession().getId());
+        WebContext.getSession().invalidate(); 
         WebContext.setAttribute(WebConstants.CURRENT_USER_SESSION_ID, WebContext.getSession().getId());
+        _logger.debug("Login Success Session {}.", WebContext.getSession().getId());
+        
         authenticationRealm.insertLoginHistory(userInfo,LOGINTYPE.LOCAL,"","xe00000004","success");
         
+        //认证设置
+	    WebContext.setAuthentication(authentication);
+	    WebContext.setUserInfo(userInfo);
+	    WebContext.getSession().setAttribute(WebConstants.CURRENT_LOGIN_USER_PASSWORD_SET_TYPE,password_set_type);
+	    
         // create new authentication response containing the user and it's authorities
         UsernamePasswordAuthenticationToken simpleUserAuthentication = new UsernamePasswordAuthenticationToken(userInfo.getUsername(), authentication.getCredentials(), authentication.getAuthorities());
         return simpleUserAuthentication;

+ 15 - 2
maxkey-core/src/main/java/org/maxkey/authn/BasicAuthentication.java

@@ -1,8 +1,10 @@
 package org.maxkey.authn;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 public class BasicAuthentication implements Authentication{
 	/**
@@ -17,10 +19,13 @@ public class BasicAuthentication implements Authentication{
     String j_remeberme;
     String j_auth_type;
     String j_jwt_token;
-    
+    ArrayList<GrantedAuthority> grantedAuthority;
     boolean authenticated;
     
 	public BasicAuthentication() {
+		grantedAuthority = new ArrayList<GrantedAuthority>();
+		grantedAuthority.add(new SimpleGrantedAuthority("ROLE_USER"));
+		grantedAuthority.add(new SimpleGrantedAuthority("ORDINARY_USER"));
 	}
 
 	@Override
@@ -30,7 +35,7 @@ public class BasicAuthentication implements Authentication{
 
 	@Override
 	public Collection<? extends GrantedAuthority> getAuthorities() {
-		return null;
+		return grantedAuthority;
 	}
 
 	@Override
@@ -122,6 +127,14 @@ public class BasicAuthentication implements Authentication{
 	public void setJ_jwt_token(String j_jwt_token) {
 		this.j_jwt_token = j_jwt_token;
 	}
+	
+	public ArrayList<GrantedAuthority> getGrantedAuthority() {
+		return grantedAuthority;
+	}
+
+	public void setGrantedAuthority(ArrayList<GrantedAuthority> grantedAuthority) {
+		this.grantedAuthority = grantedAuthority;
+	}
 
 	@Override
 	public String toString() {

+ 5 - 2
maxkey-core/src/main/java/org/maxkey/authn/RealmAuthenticationProvider.java

@@ -52,6 +52,7 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
     	authenticationRealm.passwordPolicyValid(userInfo);
     	
     	authenticationRealm.passwordMatches(userInfo, auth.getJ_password());
+    	authenticationRealm.grantAuthority(userInfo);
     	/**
     	 *  put userInfo to current session context
     	 */
@@ -63,9 +64,11 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
 		    	_logger.debug("do Remeber Me");
 		    }
 	    }
+
+	    auth.setAuthenticated(true);
 	    UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken =new UsernamePasswordAuthenticationToken(
-				userInfo,
-				auth.getJ_password(),
+	    		auth,
+				"PASSWORD",
 				authenticationRealm.grantAuthorityAndNavs(userInfo));
 	    usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetails(WebContext.getRequest()));
 	    

+ 3 - 3
maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java

@@ -69,7 +69,7 @@ public  abstract  class AbstractRemeberMeService {
 			cookie.setMaxAge(maxAge);
 			
 			//cookie.setPath("/");
-			cookie.setDomain("."+applicationConfig.getDomainName());
+			cookie.setDomain(applicationConfig.getDomainName());
 			response.addCookie(cookie);
 			request.getSession().removeAttribute(WebConstants.REMEBER_ME_SESSION);
 		}
@@ -126,7 +126,7 @@ public  abstract  class AbstractRemeberMeService {
 		cookie.setMaxAge(maxAge);
 		
 		//cookie.setPath("/");
-		cookie.setDomain("."+applicationConfig.getDomainName());
+		cookie.setDomain(applicationConfig.getDomainName());
 		response.addCookie(cookie);
 		return true;
  	}
@@ -135,7 +135,7 @@ public  abstract  class AbstractRemeberMeService {
 		Cookie cookie= new Cookie(WebConstants.REMEBER_ME_COOKIE,null);
  		cookie.setMaxAge(0);
 		
-		cookie.setDomain("."+applicationConfig.getDomainName());
+		cookie.setDomain(applicationConfig.getDomainName());
 		response.addCookie(cookie);
 		
 		remove(WebContext.getUserInfo().getUsername());

+ 18 - 1
maxkey-core/src/main/java/org/maxkey/domain/Accounts.java

@@ -2,6 +2,12 @@ package org.maxkey.domain;
 
 import java.io.Serializable;
 
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
 import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
 import org.hibernate.validator.constraints.Length;
 
@@ -15,22 +21,33 @@ import org.hibernate.validator.constraints.Length;
    STATUS	            char(1)                        null
    constraint PK_ROLES primary key clustered (ID)
  */
-public class Accounts extends JpaBaseDomain implements Serializable{
 
+@Table(name = "ACCOUNTS")  
+public class Accounts extends JpaBaseDomain implements Serializable{
 
 	/**
 	 * 
 	 */
 	private static final long serialVersionUID = 6829592256223630307L;
+	@Id
+	@Column
+	@GeneratedValue(strategy=GenerationType.AUTO,generator="uuid")
 	private String id;
+	@Column
 	private String uid;
+	@Column
 	private String username;
+	@Column
 	private String displayName;
+	@Column
 	private String appId;
+	@Column
 	private String appName;
 	
 	@Length(max=60)
+	@Column
 	private String relatedUsername;
+	@Column
 	private String relatedPassword;
 	
 	public Accounts(){

+ 18 - 0
maxkey-core/src/main/java/org/maxkey/domain/LoginAppsHistory.java

@@ -1,21 +1,39 @@
 package org.maxkey.domain;
 
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
 import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
 
 /**
  * @author Crystal.Sea
  *
  */
+
+@Table(name = "LOGIN_APPS_HISTORY")  
 public class LoginAppsHistory extends JpaBaseDomain {
 	
 	private static final long serialVersionUID = 5085201575292304749L;
+	@Id
+	@Column
+	@GeneratedValue(strategy=GenerationType.AUTO,generator="uuid")
 	String id;
+	@Column
 	private String sessionId;
+	@Column
 	private String appId;
+	@Column
 	private String appName;
+	@Column
 	private String uid;
+	@Column
 	private String username;
+	@Column
 	private String displayName;
+	@Column
 	private String loginTime;
 	
 	

+ 19 - 6
maxkey-core/src/main/java/org/maxkey/domain/LoginHistory.java

@@ -2,6 +2,9 @@ package org.maxkey.domain;
 
 import java.io.Serializable;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
+
 import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
 
 
@@ -9,32 +12,42 @@ import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
  * @author Crystal.Sea
  *
  */
+@Table(name = "LOGIN_HISTORY")  
 public class LoginHistory  extends JpaBaseDomain  implements Serializable{
 	
 	/**
 	 * 
 	 */
 	private static final long serialVersionUID = -1321470643357719383L;
-	
+	@Column
 	String sessionId;
+	@Column
 	String uid;
+	@Column
 	String username;
+	@Column
 	String displayName;
-	
+	@Column
 	String loginType;
+	@Column
 	String message;
-	
+	@Column
 	String code;
-	
+	@Column
 	String provider;
-	
+	@Column
 	String sourceIp;
+	@Column
 	String browser;
+	@Column
 	String platform;
+	@Column
 	String application;
+	@Column
 	String loginUrl;
-	
+	@Column
 	String loginTime;
+	@Column
 	String logoutTime;
 	
 	

+ 11 - 1
maxkey-core/src/main/java/org/maxkey/domain/UserInfo.java

@@ -3,6 +3,12 @@ package org.maxkey.domain;
 import java.io.IOException;
 import java.util.HashMap;
 
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
 import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.maxkey.util.StringUtils;
@@ -12,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
  * @author Crystal.Sea
  * 
  */
+@Table(name = "USERINFO")  
 public class UserInfo extends JpaBaseDomain {
 
 	/**
@@ -19,8 +26,11 @@ public class UserInfo extends JpaBaseDomain {
 	 */
 	private static final long serialVersionUID = 6402443942083382236L;
 	//
-
+	@Id
+	@Column
+	@GeneratedValue(strategy=GenerationType.AUTO,generator="uuid")
 	String id;
+	@Column
 	protected String 	username;
 	protected String 	password;
 	protected String 	decipherable;

+ 10 - 2
maxkey-core/src/main/java/org/maxkey/domain/apps/Applications.java

@@ -3,12 +3,18 @@ package org.maxkey.domain.apps;
 import java.io.Serializable;
 import java.util.Arrays;
 
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
 import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
 import org.maxkey.constants.BOOLEAN;
 import org.maxkey.domain.Accounts;
 import org.springframework.web.multipart.MultipartFile;
 
-
+@Table(name = "APPLICATIONS")  
 public class Applications extends JpaBaseDomain implements Serializable{
 	
 	/**
@@ -30,7 +36,9 @@ public class Applications extends JpaBaseDomain implements Serializable{
 		public static final int INTRANET=3;
 	}
 	
-	
+	@Id
+	@Column
+	@GeneratedValue(strategy=GenerationType.AUTO,generator="uuid")
 	protected String id;
 	/**
 	 * 

+ 12 - 1
maxkey-core/src/main/java/org/maxkey/domain/apps/CasDetails.java

@@ -1,14 +1,25 @@
 package org.maxkey.domain.apps;
 
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
 
+@Table(name = "CAS_DETAILS")  
 public class CasDetails extends Applications {
 
 	/**
 	 * 
 	 */
 	private static final long serialVersionUID = -4272290765948322084L;
+	@Id
+	@Column
+	@GeneratedValue(strategy=GenerationType.AUTO,generator="uuid")
+	private String id;
+	@Column
 	private String service;
-	
+	@Column
 	private String validation;
 	
 	/**

+ 24 - 1
maxkey-core/src/main/java/org/maxkey/domain/apps/FormBasedDetails.java

@@ -1,20 +1,33 @@
 package org.maxkey.domain.apps;
 
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
 
 /**
  * @author Crystal.Sea
  *
  */
+@Table(name = "FORM_BASED_DETAILS")  
 public class FormBasedDetails  extends Applications {
 	/**
 	 * 
 	 */
 	private static final long serialVersionUID = 563313247706861431L;
+	@Id
+	@Column
+	@GeneratedValue(strategy=GenerationType.AUTO,generator="uuid")
+	protected String id;
 	
-	
+	@Column
 	private String redirectUri;
+	@Column
 	private String usernameMapping;
+	@Column
 	private String passwordMapping;
+	@Column
 	private String authorizeView;
 
 
@@ -81,6 +94,16 @@ public class FormBasedDetails  extends Applications {
 	}
 
 
+	public String getId() {
+		return id;
+	}
+
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+
 	@Override
 	public String toString() {
 		return "FormBasedDetails [redirectUri=" + redirectUri

+ 389 - 1
maxkey-core/src/main/java/org/maxkey/domain/apps/SAML20Details.java

@@ -1,19 +1,96 @@
 package org.maxkey.domain.apps;
 
+import java.util.Arrays;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * @author Crystal.Sea
  *
  */
-public class SAML20Details   extends SAMLBaseDetails {
+@Table(name = "SAML_V20_DETAILS")  
+public class SAML20Details   extends Applications {
 
 	/**
 	 * 
 	 */
 	private static final long serialVersionUID = -291159876339333345L;
+	@Id
+	@Column
+	@GeneratedValue(strategy=GenerationType.AUTO,generator="uuid")
+	protected String id;
+	@Column
+	private String certIssuer;
+	@Column
+	private String certSubject;
+	@Column
+	private String certExpiration;
+	@Column
+	private byte[] keyStore;
 	
+	private String entityId;
+	@Column
+	private String spAcsUrl;
+	@Column
+	private String issuer;
+	@Column
+	private String audience;
+	@Column
+	private String nameidFormat;
+	@Column
+	private String validityInterval;
+	/**
+	 * Redirect-Post
+	 * Post-Post
+	 * IdpInit-Post
+	 * Redirect-PostSimpleSign
+	 * Post-PostSimpleSign
+	 * IdpInit-PostSimpleSign
+	 */
+	@Column
+	private String binding;
 
+	/**
+	 * 0  false
+	 * 1  true
+	 */
+	@Column
+	private int encrypted;
 	
+	/**
+	 * for upload
+	 */
+	@Column
+	private MultipartFile certMetaFile;
+	/**
+	 * metadata or certificate
+	 */
+	@Column
+	private String fileType;
+	
+	/**
+	 * 0 original
+	 * 1 uppercase
+	 * 2 lowercase
+	 */
+	@Column
+	private int nameIdConvert;
+
+	
+	public static class BINDINGTYPE{
+		public String Redirect_Post="Redirect-Post";
+		public String Post_Post="Post-Post";
+		public String IdpInit_Post="IdpInit-Post";
+		public String Redirect_PostSimpleSign="Redirect-PostSimpleSign";
+		public String Post_PostSimpleSign="Post-PostSimpleSign";
+		public String IdpInit_PostSimpleSign="IdpInit-PostSimpleSign";
+	}
 
 	
 	
@@ -25,4 +102,315 @@ public class SAML20Details   extends SAMLBaseDetails {
 
 	}
 
+
+	public String getId() {
+		return id;
+	}
+
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+
+	/**
+	 * @return the certIssuer
+	 */
+	public String getCertIssuer() {
+		return certIssuer;
+	}
+
+
+
+
+	/**
+	 * @param certIssuer the certIssuer to set
+	 */
+	public void setCertIssuer(String certIssuer) {
+		this.certIssuer = certIssuer;
+	}
+
+
+
+
+	/**
+	 * @return the certSubject
+	 */
+	public String getCertSubject() {
+		return certSubject;
+	}
+
+
+
+
+	/**
+	 * @param certSubject the certSubject to set
+	 */
+	public void setCertSubject(String certSubject) {
+		this.certSubject = certSubject;
+	}
+
+
+
+
+	/**
+	 * @return the certExpiration
+	 */
+	public String getCertExpiration() {
+		return certExpiration;
+	}
+
+
+
+
+	/**
+	 * @param certExpiration the certExpiration to set
+	 */
+	public void setCertExpiration(String certExpiration) {
+		this.certExpiration = certExpiration;
+	}
+
+
+
+
+	/**
+	 * @return the keyStore
+	 */
+	public byte[] getKeyStore() {
+		return keyStore;
+	}
+
+
+
+
+	/**
+	 * @param keyStore the keyStore to set
+	 */
+	public void setKeyStore(byte[] keyStore) {
+		this.keyStore = keyStore;
+	}
+
+
+
+
+	/**
+	 * @return the entityId
+	 */
+	public String getEntityId() {
+		return entityId;
+	}
+
+
+
+
+	/**
+	 * @param entityId the entityId to set
+	 */
+	public void setEntityId(String entityId) {
+		this.entityId = entityId;
+	}
+
+
+
+
+	/**
+	 * @return the spAcsUrl
+	 */
+	public String getSpAcsUrl() {
+		return spAcsUrl;
+	}
+
+
+
+
+	/**
+	 * @param spAcsUrl the spAcsUrl to set
+	 */
+	public void setSpAcsUrl(String spAcsUrl) {
+		this.spAcsUrl = spAcsUrl;
+	}
+
+
+
+
+	/**
+	 * @return the issuer
+	 */
+	public String getIssuer() {
+		return issuer;
+	}
+
+
+
+
+	/**
+	 * @param issuer the issuer to set
+	 */
+	public void setIssuer(String issuer) {
+		this.issuer = issuer;
+	}
+
+
+
+
+
+	/**
+	 * @return the audience
+	 */
+	public String getAudience() {
+		return audience;
+	}
+
+
+
+
+	/**
+	 * @param audience the audience to set
+	 */
+	public void setAudience(String audience) {
+		this.audience = audience;
+	}
+
+
+
+
+	/**
+	 * @return the nameidFormat
+	 */
+	public String getNameidFormat() {
+		return nameidFormat;
+	}
+
+
+
+
+	/**
+	 * @param nameidFormat the nameidFormat to set
+	 */
+	public void setNameidFormat(String nameidFormat) {
+		this.nameidFormat = nameidFormat;
+	}
+
+
+
+
+	/**
+	 * @return the validityInterval
+	 */
+	public String getValidityInterval() {
+		return validityInterval;
+	}
+
+
+
+
+	/**
+	 * @param validityInterval the validityInterval to set
+	 */
+	public void setValidityInterval(String validityInterval) {
+		this.validityInterval = validityInterval;
+	}
+
+
+
+
+	/**
+	 * @return the certMetaFile
+	 */
+	public MultipartFile getCertMetaFile() {
+		return certMetaFile;
+	}
+
+
+
+
+	/**
+	 * @param certMetaFile the certMetaFile to set
+	 */
+	public void setCertMetaFile(MultipartFile certMetaFile) {
+		this.certMetaFile = certMetaFile;
+	}
+
+
+
+
+	/**
+	 * @return the fileType
+	 */
+	public String getFileType() {
+		return fileType;
+	}
+
+
+
+
+	/**
+	 * @param fileType the fileType to set
+	 */
+	public void setFileType(String fileType) {
+		this.fileType = fileType;
+	}
+
+
+
+
+	public String getBinding() {
+		return binding;
+	}
+
+
+
+
+	public void setBinding(String binding) {
+		this.binding = binding;
+	}
+
+
+	public int getEncrypted() {
+		return encrypted;
+	}
+
+
+
+
+	public void setEncrypted(int encrypted) {
+		this.encrypted = encrypted;
+	}
+
+
+
+
+	public int getNameIdConvert() {
+		return nameIdConvert;
+	}
+
+
+
+
+	public void setNameIdConvert(int nameIdConvert) {
+		this.nameIdConvert = nameIdConvert;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "SAMLBaseDetails [certIssuer=" + certIssuer + ", certSubject="
+				+ certSubject + ", certExpiration=" + certExpiration
+				+ ", keyStore=" + Arrays.toString(keyStore) + ", entityId="
+				+ entityId + ", spAcsUrl=" + spAcsUrl + ", issuer=" + issuer
+				+ ", audience=" + audience + ", nameidFormat=" + nameidFormat
+				+ ", validityInterval=" + validityInterval + ", binding="
+				+ binding + ", encrypted=" + encrypted + ", certMetaFile="
+				+ certMetaFile + ", fileType=" + fileType + ", nameIdConvert="
+				+ nameIdConvert + "]";
+	}
+	
+
+	
+	
+
+
 }

+ 0 - 378
maxkey-core/src/main/java/org/maxkey/domain/apps/SAMLBaseDetails.java

@@ -1,378 +0,0 @@
-package org.maxkey.domain.apps;
-
-import java.util.Arrays;
-
-import org.springframework.web.multipart.MultipartFile;
-
-
-/**
- * @author Crystal.Sea
- *
- */
-public class SAMLBaseDetails  extends Applications {
-
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = -1091817972127532386L;
-	
-	private String certIssuer;
-	private String certSubject;
-	private String certExpiration;
-	private byte[] keyStore;
-	
-	private String entityId;
-	private String spAcsUrl;
-	private String issuer;
-	private String audience;
-	private String nameidFormat;
-	private String validityInterval;
-	/**
-	 * Redirect-Post
-	 * Post-Post
-	 * IdpInit-Post
-	 * Redirect-PostSimpleSign
-	 * Post-PostSimpleSign
-	 * IdpInit-PostSimpleSign
-	 */
-	private String binding;
-
-	/**
-	 * 0  false
-	 * 1  true
-	 */
-	private int encrypted;
-	
-	/**
-	 * for upload
-	 */
-	private MultipartFile certMetaFile;
-	/**
-	 * metadata or certificate
-	 */
-	private String fileType;
-	
-	/**
-	 * 0 original
-	 * 1 uppercase
-	 * 2 lowercase
-	 */
-	private int nameIdConvert;
-
-	
-	public static class BINDINGTYPE{
-		public String Redirect_Post="Redirect-Post";
-		public String Post_Post="Post-Post";
-		public String IdpInit_Post="IdpInit-Post";
-		public String Redirect_PostSimpleSign="Redirect-PostSimpleSign";
-		public String Post_PostSimpleSign="Post-PostSimpleSign";
-		public String IdpInit_PostSimpleSign="IdpInit-PostSimpleSign";
-	}
-
-	
-	
-	/**
-	 * 
-	 */
-	public SAMLBaseDetails() {
-		super();
-
-	}
-
-
-	/**
-	 * @return the certIssuer
-	 */
-	public String getCertIssuer() {
-		return certIssuer;
-	}
-
-
-
-
-	/**
-	 * @param certIssuer the certIssuer to set
-	 */
-	public void setCertIssuer(String certIssuer) {
-		this.certIssuer = certIssuer;
-	}
-
-
-
-
-	/**
-	 * @return the certSubject
-	 */
-	public String getCertSubject() {
-		return certSubject;
-	}
-
-
-
-
-	/**
-	 * @param certSubject the certSubject to set
-	 */
-	public void setCertSubject(String certSubject) {
-		this.certSubject = certSubject;
-	}
-
-
-
-
-	/**
-	 * @return the certExpiration
-	 */
-	public String getCertExpiration() {
-		return certExpiration;
-	}
-
-
-
-
-	/**
-	 * @param certExpiration the certExpiration to set
-	 */
-	public void setCertExpiration(String certExpiration) {
-		this.certExpiration = certExpiration;
-	}
-
-
-
-
-	/**
-	 * @return the keyStore
-	 */
-	public byte[] getKeyStore() {
-		return keyStore;
-	}
-
-
-
-
-	/**
-	 * @param keyStore the keyStore to set
-	 */
-	public void setKeyStore(byte[] keyStore) {
-		this.keyStore = keyStore;
-	}
-
-
-
-
-	/**
-	 * @return the entityId
-	 */
-	public String getEntityId() {
-		return entityId;
-	}
-
-
-
-
-	/**
-	 * @param entityId the entityId to set
-	 */
-	public void setEntityId(String entityId) {
-		this.entityId = entityId;
-	}
-
-
-
-
-	/**
-	 * @return the spAcsUrl
-	 */
-	public String getSpAcsUrl() {
-		return spAcsUrl;
-	}
-
-
-
-
-	/**
-	 * @param spAcsUrl the spAcsUrl to set
-	 */
-	public void setSpAcsUrl(String spAcsUrl) {
-		this.spAcsUrl = spAcsUrl;
-	}
-
-
-
-
-	/**
-	 * @return the issuer
-	 */
-	public String getIssuer() {
-		return issuer;
-	}
-
-
-
-
-	/**
-	 * @param issuer the issuer to set
-	 */
-	public void setIssuer(String issuer) {
-		this.issuer = issuer;
-	}
-
-
-
-
-
-	/**
-	 * @return the audience
-	 */
-	public String getAudience() {
-		return audience;
-	}
-
-
-
-
-	/**
-	 * @param audience the audience to set
-	 */
-	public void setAudience(String audience) {
-		this.audience = audience;
-	}
-
-
-
-
-	/**
-	 * @return the nameidFormat
-	 */
-	public String getNameidFormat() {
-		return nameidFormat;
-	}
-
-
-
-
-	/**
-	 * @param nameidFormat the nameidFormat to set
-	 */
-	public void setNameidFormat(String nameidFormat) {
-		this.nameidFormat = nameidFormat;
-	}
-
-
-
-
-	/**
-	 * @return the validityInterval
-	 */
-	public String getValidityInterval() {
-		return validityInterval;
-	}
-
-
-
-
-	/**
-	 * @param validityInterval the validityInterval to set
-	 */
-	public void setValidityInterval(String validityInterval) {
-		this.validityInterval = validityInterval;
-	}
-
-
-
-
-	/**
-	 * @return the certMetaFile
-	 */
-	public MultipartFile getCertMetaFile() {
-		return certMetaFile;
-	}
-
-
-
-
-	/**
-	 * @param certMetaFile the certMetaFile to set
-	 */
-	public void setCertMetaFile(MultipartFile certMetaFile) {
-		this.certMetaFile = certMetaFile;
-	}
-
-
-
-
-	/**
-	 * @return the fileType
-	 */
-	public String getFileType() {
-		return fileType;
-	}
-
-
-
-
-	/**
-	 * @param fileType the fileType to set
-	 */
-	public void setFileType(String fileType) {
-		this.fileType = fileType;
-	}
-
-
-
-
-	public String getBinding() {
-		return binding;
-	}
-
-
-
-
-	public void setBinding(String binding) {
-		this.binding = binding;
-	}
-
-
-	public int getEncrypted() {
-		return encrypted;
-	}
-
-
-
-
-	public void setEncrypted(int encrypted) {
-		this.encrypted = encrypted;
-	}
-
-
-
-
-	public int getNameIdConvert() {
-		return nameIdConvert;
-	}
-
-
-
-
-	public void setNameIdConvert(int nameIdConvert) {
-		this.nameIdConvert = nameIdConvert;
-	}
-
-
-	/* (non-Javadoc)
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-		return "SAMLBaseDetails [certIssuer=" + certIssuer + ", certSubject="
-				+ certSubject + ", certExpiration=" + certExpiration
-				+ ", keyStore=" + Arrays.toString(keyStore) + ", entityId="
-				+ entityId + ", spAcsUrl=" + spAcsUrl + ", issuer=" + issuer
-				+ ", audience=" + audience + ", nameidFormat=" + nameidFormat
-				+ ", validityInterval=" + validityInterval + ", binding="
-				+ binding + ", encrypted=" + encrypted + ", certMetaFile="
-				+ certMetaFile + ", fileType=" + fileType + ", nameIdConvert="
-				+ nameIdConvert + "]";
-	}
-
-}

+ 22 - 0
maxkey-core/src/main/java/org/maxkey/domain/apps/TokenBasedDetails.java

@@ -3,11 +3,17 @@
  */
 package org.maxkey.domain.apps;
 
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
 
 /**
  * @author Crystal.Sea
  *
  */
+@Table(name = "TOKEN_BASED_DETAILS") 
 public class TokenBasedDetails  extends Applications {
 
 	/**
@@ -15,23 +21,39 @@ public class TokenBasedDetails  extends Applications {
 	 */
 	private static final long serialVersionUID = -1717427271305620545L;
 
+	@Id
+	@Column
+	@GeneratedValue(strategy=GenerationType.AUTO,generator="uuid")
+	protected String id;
 	/**
 	 * 
 	 */
+	@Column
 	private String redirectUri;
 	//
+	@Column
 	private String cookieName;
+	@Column
 	private String algorithm;
+	@Column
 	private String algorithmKey;
+	@Column
 	private String expires;
 	
 	//
+	@Column
 	private int uid;
+	@Column
 	private int username;
+	@Column
 	private int email;
+	@Column
 	private int windowsAccount;
+	@Column
 	private int employeeNumber;
+	@Column
 	private int departmentId;
+	@Column
 	private int department;
 	
 	

+ 2 - 0
maxkey-core/src/main/java/org/maxkey/web/WebConstants.java

@@ -53,4 +53,6 @@ public class WebConstants {
 	
 	public static final String CURRENT_SINGLESIGNON_URI				=	"current_singlesignon_uri";
 	
+	public static final String AUTHENTICATION						=	"current_authentication";
+	
 }

+ 8 - 4
maxkey-core/src/main/java/org/maxkey/web/WebContext.java

@@ -147,11 +147,15 @@ public final class WebContext {
 	    }
 	    return true;
 	  }
+
+	public static void setAuthentication(Authentication authentication) {
+		setAttribute(WebConstants.AUTHENTICATION,authentication);
+	}
 	
-	public static Authentication getAuthentication(){
-	      UsernamePasswordAuthenticationToken authentication =(UsernamePasswordAuthenticationToken)SecurityContextHolder.getContext().getAuthentication();
-	      return authentication;
-	  }
+	public static Authentication getAuthentication() {
+		Authentication authentication = (Authentication)getAttribute(WebConstants.AUTHENTICATION);
+		return authentication;
+	}
 	  
 	  public static boolean isAuthenticated(){
 	    if (getUserInfo() != null) {

+ 12 - 0
maxkey-dao/.classpath

@@ -12,6 +12,18 @@
 			<attribute name="gradle_used_by_scope" value="main,test"/>
 		</attributes>
 	</classpathentry>
+	<classpathentry kind="src" output="bin/test" path="src/test/java">
+		<attributes>
+			<attribute name="gradle_scope" value="test"/>
+			<attribute name="gradle_used_by_scope" value="test"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="bin/test" path="src/test/resources">
+		<attributes>
+			<attribute name="gradle_scope" value="test"/>
+			<attribute name="gradle_used_by_scope" value="test"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
 	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
 	<classpathentry kind="output" path="bin/default"/>

+ 2 - 0
maxkey-dao/.settings/org.eclipse.wst.common.component

@@ -2,5 +2,7 @@
     <wb-module deploy-name="maxkey-dao">
         <wb-resource deploy-path="/" source-path="/src/main/java"/>
         <wb-resource deploy-path="/" source-path="/src/main/resources"/>
+        <wb-resource deploy-path="/" source-path="/src/test/java"/>
+        <wb-resource deploy-path="/" source-path="/src/test/resources"/>
     </wb-module>
 </project-modules>

+ 3 - 1
maxkey-dao/src/main/java/org/maxkey/dao/persistence/MyAppsListMapper.java

@@ -3,6 +3,8 @@
  */
 package org.maxkey.dao.persistence;
 
+import java.util.List;
+
 import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
 import org.maxkey.domain.apps.UserApplications;
 
@@ -12,5 +14,5 @@ import org.maxkey.domain.apps.UserApplications;
  */
 public  interface MyAppsListMapper extends IJpaBaseMapper<UserApplications> {
 	
-
+	public List<UserApplications> queryMyApps(UserApplications userApplications);
 }

+ 5 - 0
maxkey-dao/src/main/java/org/maxkey/dao/service/MyAppsListService.java

@@ -1,5 +1,7 @@
 package org.maxkey.dao.service;
 
+import java.util.List;
+
 import org.apache.mybatis.jpa.persistence.JpaBaseService;
 import org.maxkey.dao.persistence.MyAppsListMapper;
 import org.maxkey.domain.apps.UserApplications;
@@ -12,6 +14,9 @@ public class MyAppsListService  extends JpaBaseService<UserApplications>{
 		super(MyAppsListMapper.class);
 	}
 
+	public List<UserApplications> queryMyApps(UserApplications userApplications){
+		return getMapper().queryMyApps(userApplications);
+	}
 	/* (non-Javadoc)
 	 * @see com.connsec.db.service.BaseService#getMapper()
 	 */

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/DesktopDetailsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.DesktopDetailsMapper">
+<mapper namespace="org.maxkey.dao.persistence.DesktopDetailsMapper">
 
 	
 </mapper>

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ForgotPasswordMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.ForgotPasswordMapper">
+<mapper namespace="org.maxkey.dao.persistence.ForgotPasswordMapper">
 
 	<select id="queryUserInfoByEmail" parameterType="string" resultType="UserInfo">
 		SELECT

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/FormBasedDetailsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.FormBasedDetailsMapper">
+<mapper namespace="org.maxkey.dao.persistence.FormBasedDetailsMapper">
 
 	
 </mapper>

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/GroupMemberMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.GroupMemberMapper">
+<mapper namespace="org.maxkey.dao.persistence.GroupMemberMapper">
 
 	<sql id="where_statement">
     	<if test="id != null and id != ''">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/GroupsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.GroupsMapper">
+<mapper namespace="org.maxkey.dao.persistence.GroupsMapper">
 
 	<sql id="where_statement">
     	<if test="id != null and id != ''">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/IpAddrFilterMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.IpAddrFilterMapper">
+<mapper namespace="org.maxkey.dao.persistence.IpAddrFilterMapper">
 	<sql id="where_statement">
     	<if test="id != null and id != ''">
 			AND	ID	=	#{id}

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/LoginAppsHistoryMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.LoginAppsHistoryMapper" >
+<mapper namespace="org.maxkey.dao.persistence.LoginAppsHistoryMapper" >
 
 	<sql id="dao_where_statement">
     	<if test="id != null and id != ''">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/LoginHistoryMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.LoginHistoryMapper" >
+<mapper namespace="org.maxkey.dao.persistence.LoginHistoryMapper" >
 
 	<sql id="dao_where_statement">
     	<if test="id != null and id != ''">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/LogsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.LogsMapper" >
+<mapper namespace="org.maxkey.dao.persistence.LogsMapper" >
 
 	<sql id="where_statement">
     	<if test="id != null and id != ''">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/MyAppsListMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.maxkey.dao.persistence.MyAppsListMapper">
 
-	<select id="query" parameterType="UserApplications" resultType="UserApplications">
+	<select id="queryMyApps" parameterType="UserApplications" resultType="UserApplications">
 		SELECT DISTINCT
 			APP.*
 		FROM

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/MyProfileMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.MyProfileMapper">
+<mapper namespace="org.maxkey.dao.persistence.MyProfileMapper">
 
 	<update id="updateBasic" parameterType="UserInfo" >
     	UPDATE USERINFO SET

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/NavigationsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.NavigationsMapper" >
+<mapper namespace="org.maxkey.dao.persistence.NavigationsMapper" >
 
 	<sql id="dao_where_statement">
     	<if test="id != null and id != ''">

+ 0 - 5
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/Oauth10aDetailsMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.Oauth10aDetailsMapper">
-
-</mapper>

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/OrganizationsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.OrganizationsMapper" >
+<mapper namespace="org.maxkey.dao.persistence.OrganizationsMapper" >
 
 	<sql id="dao_where_statement">
     	<if test="id != null and id != ''">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/PasswordPolicyMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.PasswordPolicyMapper" >
+<mapper namespace="org.maxkey.dao.persistence.PasswordPolicyMapper" >
 	
    
 </mapper>

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RegistrationMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.RegistrationMapper">
+<mapper namespace="org.maxkey.dao.persistence.RegistrationMapper">
 	
 	<select id="queryUserInfoByEmail" parameterType="string" resultType="UserInfo">
 		SELECT

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ReportMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.ReportMapper" >
+<mapper namespace="org.maxkey.dao.persistence.ReportMapper" >
 
 	<select id="analysisDay" parameterType="String" resultType="Map">
     	SELECT 

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RoleNavMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.RoleNavMapper" >
+<mapper namespace="org.maxkey.dao.persistence.RoleNavMapper" >
 	<sql id="sql_condition">
 		WHERE	1	=	1
     	<if test="id != null">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RoleUserMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.RoleUserMapper" >
+<mapper namespace="org.maxkey.dao.persistence.RoleUserMapper" >
 	<sql id="sql_condition">
 		WHERE	1	=	1
     	<if test="id != null">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RolesMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.RolesMapper" >
+<mapper namespace="org.maxkey.dao.persistence.RolesMapper" >
 	<sql id="sql_condition">
 		WHERE	1	=	1
     	<if test="id != null">

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/Saml20DetailsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.Saml20DetailsMapper">
+<mapper namespace="org.maxkey.dao.persistence.Saml20DetailsMapper">
 
 	
     

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/Saml20MetadataMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.Saml20MetadataMapper">
+<mapper namespace="org.maxkey.dao.persistence.Saml20MetadataMapper">
 
 	
 </mapper>

+ 1 - 1
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/TokenBasedDetailsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.connsec.dao.persistence.TokenBasedDetailsMapper">
+<mapper namespace="org.maxkey.dao.persistence.TokenBasedDetailsMapper">
 
 	
 </mapper>

+ 91 - 0
maxkey-dao/src/test/java/org/apache/mybatis/jpa/test/AccountsServiceTest.java

@@ -0,0 +1,91 @@
+package org.apache.mybatis.jpa.test;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.mybatis.jpa.util.WebContext;
+import org.junit.Before;
+import org.junit.Test;
+import org.maxkey.dao.service.AccountsService;
+import org.maxkey.dao.service.FormBasedDetailsService;
+import org.maxkey.domain.Accounts;
+import org.maxkey.domain.apps.FormBasedDetails;
+import org.maxkey.util.PathUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class AccountsServiceTest {
+	
+	private static final Logger _logger = LoggerFactory.getLogger(AccountsServiceTest.class);
+	
+	public static ApplicationContext context;
+	
+	public static AccountsService service;
+	
+	public AccountsService getservice() {
+		service=(AccountsService)WebContext.getBean("accountsService");
+		return service;
+	}
+	
+
+	@Test
+	public void get() throws Exception{
+		_logger.info("get...");
+		Accounts accounts=service.get("26b1c864-ae81-4b1f-9355-74c4c699cb6b");
+		
+		 _logger.info("accounts "+accounts);
+
+	}
+	
+	@Test
+	public void load() throws Exception{
+		_logger.info("get...");
+		Accounts queryAccounts=new Accounts("7BF5315CA1004CDB8E614B0361C4D46B","fe86db85-5475-4494-b5aa-dbd3b886ff64");
+		Accounts accounts=service.load(queryAccounts);
+		
+		 _logger.info("accounts "+accounts);
+
+	}
+	
+	
+	@Test
+	public void findAll() throws Exception{
+		_logger.info("findAll...");
+		_logger.info("findAll "+service.findAll());
+	}
+	
+	@Before
+	public void initSpringContext(){
+		if(context!=null) return;
+		_logger.info("init Spring Context...");
+		SimpleDateFormat sdf_ymdhms =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String startTime=sdf_ymdhms.format(new Date());
+
+		try{
+			AccountsServiceTest runner=new AccountsServiceTest();
+			runner.init();
+			
+		}catch(Exception e){
+			e.printStackTrace();
+		}
+		
+		_logger.info("-- --Init Start at " + startTime+" , End at  "+sdf_ymdhms.format(new Date()));
+	}
+	
+	//Initialization ApplicationContext for Project
+	public void init(){
+		_logger.info("init ...");
+		
+		_logger.info("Application dir "+System.getProperty("user.dir"));
+		context = new ClassPathXmlApplicationContext(new String[] {"spring/applicationContext.xml"});
+		WebContext.applicationContext=context;
+		getservice();
+		System.out.println("init ...");
+		
+	}
+	
+}

+ 141 - 0
maxkey-dao/src/test/java/org/apache/mybatis/jpa/test/FormBasedDetailsServiceTest.java

@@ -0,0 +1,141 @@
+package org.apache.mybatis.jpa.test;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.mybatis.jpa.util.WebContext;
+import org.junit.Before;
+import org.junit.Test;
+import org.maxkey.dao.service.FormBasedDetailsService;
+import org.maxkey.domain.apps.FormBasedDetails;
+import org.maxkey.util.PathUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class FormBasedDetailsServiceTest {
+	
+	private static final Logger _logger = LoggerFactory.getLogger(FormBasedDetailsServiceTest.class);
+	
+	public static ApplicationContext context;
+	
+	public static FormBasedDetailsService service;
+	
+	public FormBasedDetailsService getservice() {
+		service=(FormBasedDetailsService)WebContext.getBean("formBasedDetailsService");
+		return service;
+	}
+	
+	@Test
+	public void insert() throws Exception{
+		_logger.info("insert...");
+		
+		FormBasedDetails formBasedDetails=new FormBasedDetails();
+		
+		service.insert(formBasedDetails);
+		
+		Thread.sleep(1000);
+		service.remove(formBasedDetails.getId());
+		
+	}
+	
+	@Test
+	public void get() throws Exception{
+		_logger.info("get...");
+		FormBasedDetails formBasedDetails=service.get("850379a1-7923-4f6b-90be-d363b2dfd2ca");
+		
+		 _logger.info("formBasedDetails "+formBasedDetails);
+
+	}
+	
+	
+	@Test
+	public void remove() throws Exception{
+		
+		_logger.info("remove...");
+		FormBasedDetails formBasedDetails=new FormBasedDetails();
+		formBasedDetails.setId("921d3377-937a-4578-b1e2-92fb23b5e512");
+		service.remove(formBasedDetails.getId());
+		
+	}
+	
+	@Test
+	public void batchDelete() throws Exception{
+		_logger.info("batchDelete...");	
+		List<String> idList=new ArrayList<String>();
+		idList.add("8584804d-b5ac-45d2-9f91-4dd8e7a090a7");
+		idList.add("ab7422e9-a91a-4840-9e59-9d911257c918");
+		idList.add("12b6ceb8-573b-4f01-ad85-cfb24cfa007c");
+		idList.add("dafd5ba4-d2e3-4656-bd42-178841e610fe");
+		service.batchDelete(idList);
+	}
+
+	@Test
+	public void queryPageResults() throws Exception{
+		
+		_logger.info("queryPageResults...");
+		FormBasedDetails formBasedDetails=new FormBasedDetails();
+		 //student.setId("af04d610-6092-481e-9558-30bd63ef783c");
+		// student.setStdGender("M");
+		 //student.setStdMajor(政治");
+		 //student.setPageResults(10);
+		 //student.setPage(2);
+		 //_logger.info("queryPageResults "+service.queryPageResults(formBasedDetails));
+	}
+	
+	@Test
+	public void queryPageResultsByMapperId() throws Exception{
+
+		_logger.info("queryPageResults by mapperId...");
+		 FormBasedDetails formBasedDetails=new FormBasedDetails();
+		// student.setStdGender("M");
+		 //student.setStdMajor(政治");
+		// student.setPageResults(10);
+		// student.setPage(2);
+		 
+		 //_logger.info("queryPageResults by mapperId "+service.queryPageResults("queryPageResults1",formBasedDetails));
+		 
+	}
+	
+	
+	
+	@Test
+	public void findAll() throws Exception{
+		_logger.info("findAll...");
+		_logger.info("findAll "+service.findAll());
+	}
+	
+	@Before
+	public void initSpringContext(){
+		if(context!=null) return;
+		_logger.info("init Spring Context...");
+		SimpleDateFormat sdf_ymdhms =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String startTime=sdf_ymdhms.format(new Date());
+
+		try{
+			FormBasedDetailsServiceTest runner=new FormBasedDetailsServiceTest();
+			runner.init();
+			
+		}catch(Exception e){
+			e.printStackTrace();
+		}
+		
+		_logger.info("-- --Init Start at " + startTime+" , End at  "+sdf_ymdhms.format(new Date()));
+	}
+	
+	//Initialization ApplicationContext for Project
+	public void init(){
+		_logger.info("init ...");
+		
+		_logger.info("Application dir "+System.getProperty("user.dir"));
+		context = new ClassPathXmlApplicationContext(new String[] {"spring/applicationContext.xml"});
+		WebContext.applicationContext=context;
+		getservice();
+		System.out.println("init ...");
+		
+	}
+	
+}

+ 29 - 0
maxkey-dao/src/test/resources/config/applicationConfig.properties

@@ -0,0 +1,29 @@
+############################################################################
+#                DataBase configuration  
+############################################################################
+#db2,derby,mysql,oracle,postgresql,sqlserver 
+config.datasource.database=mysql
+# JDBC Driver                                                              
+#     for MySql         com.mysql.jdbc.Driver                              
+#     for oracle        oracle.jdbc.driver.OracleDriver                    
+#     for DB2           com.ibm.db2.jdbc.app.DB2Driver   
+#						com.ibm.db2.jcc.DB2Driver                  
+#     for SqlServer     com.microsoft.jdbc.sqlserver.SQLServerDriver        
+#     for SyBase        com.sybase.jdbc.SybDriver                          
+#     for PostgreSQL    org.postgresql.Driver        
+#	  for Derby			org.apache.derby.jdbc.ClientDriver  
+# JDBC URL
+#    you need database hostname,port,databasename
+#     for MySql           jdbc:mysql://hostname:port/secdb
+#     for oracle          jdbc:oracle:thin:@hostname:port:secdb
+#     for DB2             jdbc:db2://hostname:port/secdb
+#     for SqlServer       jdbc:microsoft:sqlserver://hostname:port;DatabaseName=secdb
+#     for SyBase          jdbc:sybase:Tds:hostname:port/secdb
+#	  for Derby			  jdbc:derby://localhost:1527/secdb
+#
+config.datasource.driverclass=com.mysql.jdbc.Driver
+config.datasource.url=jdbc:mysql://localhost/maxkey?autoReconnect=true&characterEncoding=UTF-8
+config.datasource.username=root
+config.datasource.password=connsec
+
+############################################################################

+ 27 - 0
maxkey-dao/src/test/resources/log4j2.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>  
+<configuration status="INFO">  
+    <appenders>  
+    	
+        <Console name="consolePrint" target="SYSTEM_OUT">  
+            <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} [%t] %-5level %logger{36} - %msg%n" />  
+        </Console>
+        <!--
+        <File name="File" fileName="logs/maxkey-dao.log">
+            <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} [%t] %-5level %logger{36} - %msg%n" />
+        </File>
+        -->
+  
+	 </appenders>  
+	 
+    <loggers>  
+    	<Logger name="org.springframework" level="INFO"></Logger>
+    	<Logger name="org.apache.logging" level="INFO"></Logger>
+    	<Logger name="org.maxkey" level="DEBUG"></Logger>
+    	<Logger name="org.apache.mybatis" level="TRACE"></Logger>
+    	
+    	
+        <root level="INFO">  
+            <appender-ref ref="consolePrint" /> 
+        </root>  
+    </loggers>  
+</configuration>

+ 33 - 0
maxkey-dao/src/test/resources/spring/applicationContext-database.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans 	xmlns="http://www.springframework.org/schema/beans"
+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+		xmlns:aop="http://www.springframework.org/schema/aop"
+		xmlns:tx="http://www.springframework.org/schema/tx" 
+		xmlns:jdbc="http://www.springframework.org/schema/jdbc"
+		xmlns:context="http://www.springframework.org/schema/context"
+		xsi:schemaLocation="
+	     http://www.springframework.org/schema/context 
+	     http://www.springframework.org/schema/context/spring-context.xsd
+	     http://www.springframework.org/schema/beans 
+	     http://www.springframework.org/schema/beans/spring-beans.xsd
+	     http://www.springframework.org/schema/jdbc 
+	     http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
+	     http://www.springframework.org/schema/tx 
+	     http://www.springframework.org/schema/tx/spring-tx.xsd
+	     http://www.springframework.org/schema/aop 
+	     http://www.springframework.org/schema/aop/spring-aop.xsd">
+
+	<!-- dataSource define begin -->
+	<!-- c3p0 configuration -->
+	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"  destroy-method="close" >      
+	    <property name="driverClass" value="${config.datasource.driverclass}"/>      
+	    <property name="jdbcUrl" value="${config.datasource.url}"/>      
+	    <property name="user" value="${config.datasource.username}"/>      
+	    <property name="password" value="${config.datasource.password}"/>  
+	    <property name="maxPoolSize" value="30"/> 
+	    <property name="minPoolSize" value="21"/> 
+	    <property name="initialPoolSize" value="15"/> 
+	    
+	</bean> 
+
+</beans>

+ 87 - 0
maxkey-dao/src/test/resources/spring/applicationContext-persist.xml

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
+  xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
+  xmlns:cache="http://www.springframework.org/schema/cache"
+  xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/context
+        http://www.springframework.org/schema/context/spring-context.xsd
+        http://www.springframework.org/schema/tx
+        http://www.springframework.org/schema/tx/spring-tx.xsd
+        http://www.springframework.org/schema/aop
+        http://www.springframework.org/schema/aop/spring-aop.xsd
+        http://www.springframework.org/schema/cache
+        http://www.springframework.org/schema/cache/spring-cache-3.2.xsd">
+
+
+  <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+    <property name="dataSource" ref="dataSource" />
+  </bean>
+
+  <tx:annotation-driven transaction-manager="txManager" />
+
+  <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+    <property name="dataSource" ref="dataSource" />
+  </bean>
+
+    <!-- enable autowire -->
+    <context:annotation-config />
+
+    <!-- enable transaction demarcation with annotations 
+    <tx:annotation-driven />-->
+
+	<!--<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">-->
+	<bean id="sqlSessionFactory" class="org.apache.mybatis.jpa.MyBatisSessionFactoryBean">
+		<property name="timeout" value="30" />
+		<property name="dataSource" ref="dataSource" />
+		<property name="mapperLocations" value="classpath*:/org/maxkey/dao/persistence/xml/mysql/*.xml" />
+		<property name="typeAliasesPackage" 
+        		  value="
+	        			org.maxkey.domain,
+	        			org.maxkey.domain.apps,
+        			" />
+		<property name="transactionFactory">
+			<bean class="org.apache.ibatis.transaction.managed.ManagedTransactionFactory" />
+		</property>
+		<property name="interceptors">
+			<list>
+					<bean class="org.apache.mybatis.jpa.StatementHandlerInterceptor">
+						<property name="dialectString" value="org.apache.mybatis.jpa.dialect.MySQLDialect"/>
+					</bean>
+			</list>
+		</property>
+	</bean>
+
+    <!-- scan for mappers and let them be autowired -->
+    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
+        <property name="basePackage" 
+        		  value="
+        		  		org.maxkey.dao.persistence,
+        		  		" />
+      
+    </bean>
+
+ 	<!-- enable component scanning (beware that this does not enable mapper scanning!) -->    
+    <context:component-scan base-package="org.maxkey.dao.service" />
+    
+    <bean class ="org.apache.mybatis.jpa.id.IdentifierGeneratorFactory">
+    <!-- 
+	    <property name="generatorStrategyMap" >
+	    	<map>
+		        <entry key="serial" >
+		        	<bean class="org.apache.mybatis.jpa.id.SerialGenerator">
+		        		<property name="ipAddressNodeValue"  value="F0-76-1C-B0-26-9C=02,"/>
+		        	</bean></entry>
+		    </map>
+	    </property>
+	    -->
+    </bean>
+    
+   	<!-- 
+	<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
+		<constructor-arg index="0" ref="sqlSessionFactory" />
+	</bean>
+	 -->
+</beans>

+ 47 - 0
maxkey-dao/src/test/resources/spring/applicationContext.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans 	xmlns="http://www.springframework.org/schema/beans"
+		xmlns:context="http://www.springframework.org/schema/context"
+		xmlns:mvc="http://www.springframework.org/schema/mvc"
+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+		xmlns:p="http://www.springframework.org/schema/p"
+		xmlns:tx="http://www.springframework.org/schema/tx"
+		xmlns:util="http://www.springframework.org/schema/util"
+		xsi:schemaLocation="
+	        http://www.springframework.org/schema/beans     
+	        http://www.springframework.org/schema/beans/spring-beans.xsd
+	        http://www.springframework.org/schema/context 
+	        http://www.springframework.org/schema/context/spring-context.xsd
+	        http://www.springframework.org/schema/tx 
+	        http://www.springframework.org/schema/tx/spring-tx.xsd
+	        http://www.springframework.org/schema/util     
+	        http://www.springframework.org/schema/util/spring-util.xsd
+	        http://www.springframework.org/schema/mvc 
+	        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+ 	<!-- 
+ 	<import resource="applicationContext-task.xml"/>
+ 	-->
+ 	<!-- Application properties configs  -->
+	<bean id="propertySourcesPlaceholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
+	  <property name="locations">
+	    <list>
+	   	  	<value>classpath:config/applicationConfig.properties</value>
+	    </list>
+	  </property>
+	  <property name="ignoreUnresolvablePlaceholders" value="true"/>
+	</bean>
+ 	
+ 	<!-- Authentication Password Encoder Config -->
+	<bean id="passwordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></bean>   
+	
+	<bean id="passwordReciprocal" class="org.maxkey.crypto.password.PasswordReciprocal"></bean>
+	
+ 	<!-- Datastore configuration  -->
+ 	<import resource="applicationContext-database.xml"/>
+ 	<import resource="applicationContext-persist.xml"/>
+ 
+ 	
+ 	<!-- 配置执行的任务列表  -->
+ 	<util:list id="businessTask" list-class="java.util.ArrayList">
+
+ 	</util:list>
+</beans>

+ 76 - 73
maxkey-demos/maxkey-demo-cas/src/main/webapp/WEB-INF/web.xml

@@ -1,75 +1,78 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
-  <display-name></display-name>
-  <listener>
-    <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
-  </listener>
-  <filter>
-    <filter-name>CAS Single Sign Out Filter</filter-name>
-    <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
-  </filter>
-  <filter-mapping>
-    <filter-name>CAS Single Sign Out Filter</filter-name>
-    <url-pattern>/*</url-pattern>
-  </filter-mapping>
-  <filter>
-    <filter-name>CAS Filter</filter-name>
-    <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
-    <!-- cas server login url -->
-    <init-param>
-      <param-name>casServerLoginUrl</param-name>
-      <param-value>>http://login.connsec.com/maxkey/authz/cas/</param-value>
-    </init-param>
-    <!-- cas client url,  in end of url / is required-->
-    <init-param>
-      <param-name>serverName</param-name>
-      <param-value>http://cas.demo.connsec.com/</param-value>
-    </init-param>
-  </filter>
-  <filter-mapping>
-    <filter-name>CAS Filter</filter-name>
-    <url-pattern>/*</url-pattern>
-  </filter-mapping>
-  
-  <!--  Cas10TicketValidationFilter
-  		Cas20ProxyReceivingTicketValidationFilter
-   -->
-  <filter>
-    <filter-name>CAS Validation Filter</filter-name>
-    <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
-   <!-- cas server login url -->
-    <init-param>
-      <param-name>casServerUrlPrefix</param-name>
-      <param-value>http://login.connsec.com/maxkey/authz/cas/</param-value>
-    </init-param>
-     <!-- cas client url -->
-    <init-param>
-      <param-name>serverName</param-name>
-      <param-value>http://cas.demo.connsec.com/</param-value>
-    </init-param>
-  </filter>
-  <filter-mapping>
-    <filter-name>CAS Validation Filter</filter-name>
-    <url-pattern>/*</url-pattern>
-  </filter-mapping>
-  <filter>
-    <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
-    <filter-class>
-	                org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>
-  </filter>
-  <filter-mapping>
-    <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
-    <url-pattern>/*</url-pattern>
-  </filter-mapping>
-  <filter>
-    <filter-name>CAS Assertion Thread Local Filter</filter-name>
-    <filter-class>org.jasig.cas.client.util.AssertionThreadLocalFilter</filter-class>
-  </filter>
-  <filter-mapping>
-    <filter-name>CAS Assertion Thread Local Filter</filter-name>
-    <url-pattern>/*</url-pattern>
-  </filter-mapping>
-  <welcome-file-list>
-    <welcome-file>index.jsp</welcome-file>
-  </welcome-file-list>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee"
+	xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	version="2.5">
+	<display-name></display-name>
+	<listener>
+		<listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
+	</listener>
+	<filter>
+		<filter-name>CAS Single Sign Out Filter</filter-name>
+		<filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
+	</filter>
+	<filter-mapping>
+		<filter-name>CAS Single Sign Out Filter</filter-name>
+		<url-pattern>/index.jsp</url-pattern>
+	</filter-mapping>
+	<filter>
+		<filter-name>CAS Filter</filter-name>
+		<filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
+		<!-- cas server login url -->
+		<init-param>
+			<param-name>casServerLoginUrl</param-name>
+			<param-value>>http://sso.maxkey.org/maxkey/authz/cas/</param-value>
+		</init-param>
+		<!-- cas client url, in end of url / is required -->
+		<init-param>
+			<param-name>serverName</param-name>
+			<param-value>http://casdemo.maxkey.org/</param-value>
+		</init-param>
+	</filter>
+	<filter-mapping>
+		<filter-name>CAS Filter</filter-name>
+		<url-pattern>/index.jsp</url-pattern>
+	</filter-mapping>
+
+	<!-- Cas10TicketValidationFilter Cas20ProxyReceivingTicketValidationFilter -->
+	<filter>
+		<filter-name>CAS Validation Filter</filter-name>
+		<filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
+		<!-- cas server login url -->
+		<init-param>
+			<param-name>casServerUrlPrefix</param-name>
+			<param-value>http://sso.maxkey.org/maxkey/authz/cas/</param-value>
+		</init-param>
+		<!-- cas client url -->
+		<init-param>
+			<param-name>serverName</param-name>
+			<param-value>http://casdemo.maxkey.org/</param-value>
+		</init-param>
+	</filter>
+	<filter-mapping>
+		<filter-name>CAS Validation Filter</filter-name>
+		<url-pattern>/index.jsp</url-pattern>
+	</filter-mapping>
+	<filter>
+		<filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
+		<filter-class>
+			org.jasig.cas.client.util.HttpServletRequestWrapperFilter
+		</filter-class>
+	</filter>
+	<filter-mapping>
+		<filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
+		<url-pattern>/index.jsp</url-pattern>
+	</filter-mapping>
+	<filter>
+		<filter-name>CAS Assertion Thread Local Filter</filter-name>
+		<filter-class>org.jasig.cas.client.util.AssertionThreadLocalFilter</filter-class>
+	</filter>
+	<filter-mapping>
+		<filter-name>CAS Assertion Thread Local Filter</filter-name>
+		<url-pattern>/index.jsp</url-pattern>
+	</filter-mapping>
+	<welcome-file-list>
+		<welcome-file>index.jsp</welcome-file>
+	</welcome-file-list>
 </web-app>

+ 1 - 1
maxkey-demos/maxkey-demo-cas/src/main/webapp/index.jsp

@@ -7,7 +7,7 @@
 <%
 	String path = request.getContextPath();
 	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
-
+	System.out.println("CAS Assertion Success . ");
 	Assertion assertion = (Assertion) request.getSession().getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
 	                
 	                

+ 72 - 0
maxkey-demos/maxkey-demo-cas/src/main/webapp/test.html

@@ -0,0 +1,72 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <base href="<%=basePath%>">
+    
+    <title>Demo CAS</title>
+	<meta http-equiv="pragma" content="no-cache">
+	<meta http-equiv="cache-control" content="no-cache">
+	<meta http-equiv="expires" content="0">    
+	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
+	<meta http-equiv="description" content="CAS Demo">
+	<!--
+	<link rel="stylesheet" type="text/css" href="styles.css">
+	-->
+	<style type="text/css">
+		body{
+			margin: 0;
+			margin-top: 0px;
+			margin-left: auto;
+			margin-right: auto;
+			padding: 0 0 0 0px;
+			font-size: 12px;
+			text-align:center;
+			float:center;
+			font-family: "Arial", "Helvetica", "Verdana", "sans-serif";
+		}
+		.container {
+			width: 990px;
+			margin-left: auto;
+			margin-right: auto;
+			padding: 0 10px
+		}
+		table.datatable {
+			border: 1px solid #d8dcdf;
+			border-collapse:collapse;
+			border-spacing:0;
+			width: 100%;
+		}
+		
+		table.datatable th{
+			border: 1px solid #d8dcdf;
+			border-collapse:collapse;
+			border-spacing:0;
+			height: 40px;
+		}
+		
+		
+		table.datatable td{
+			border: 1px solid #d8dcdf;
+			border-collapse:collapse;
+			border-spacing:0;
+			height: 40px;
+		}
+		
+		table.datatable td.title{
+			text-align: center;
+			font-size: 20px;
+			font-weight: bold;
+		}
+	</style>
+  </head>
+  
+  <body>
+  		<div class="container">
+	  		<table class="datatable">
+	  			<tr>
+	  				<td colspan="2" class="title">CAS Demo for MaxKey Test</td>
+	  			</tr>
+	  		</table>
+  		</div>
+  </body>
+</html>

+ 3 - 3
maxkey-demos/maxkey-demo-jwt/bin/main/jwk.jwks

@@ -1,12 +1,12 @@
 {
   "keys": [
     {
-      "e": "AQAB",
-      "n": "h5xtDWLssoj5-WLCKPYPUDJlM5pnL4pS8-wMt9sVA57QVRVFdpWHi1dbDCugCApjvmD-giO5yjF5mQSTAF6a14FvktozVw_dDTEzrjG5FgT6WpMzMZd6JpiwQLOtEbV7oBkKYWm1vh1C67-xTlhKgQUNLVNDg4RqRcKFxZd5JPc",
       "kty": "RSA",
+	  "e": "AQAB",
       "use": "sig",
+      "kid": "maxkey_rsa",
       "alg": "RS256",
-      "kid": "connsec_rsa"
+      "n": "vyfZwQuBLNvJDhmziUCFuAfIv-bC6ivodcR6PfanTt8XLd6G63Yx10YChAdsDACjoLz1tEU56WPp_ee_vcTSsEZT3ouWJYghuGI2j4XclXlEj0S7DzdpcBBpI4n5dr8K3iKY-3JUMZR1AMBHI50UaMST9ZTZJAjUPIYxkhRdca5lWBo4wGUh1yj_80-Bq6al0ia9S5NTzNLaJ18jSxFqZ79BAkBm-KjkP248YUk6WBGtYEAV5Fws4dpse4hrqJ3RRHiMZV1o1iTmPHz_l55ZSDP3vpYf6iKqKzoK2RmdjfH5mGpbc4-PclTs4GKfwZ7cWfrny6B7sMnQfzujCH996Q"
     }
   ]
 }

BIN
maxkey-demos/maxkey-demo-jwt/lib/connsec-oidc.jar


BIN
maxkey-demos/maxkey-demo-jwt/lib/maxkey-client-sdk.jar


BIN
maxkey-demos/maxkey-demo-jwt/lib/maxkey-jose-jwt.jar


BIN
maxkey-demos/maxkey-demo-jwt/lib/nimbus-jose-jwt-3.5.jar


+ 3 - 3
maxkey-demos/maxkey-demo-jwt/src/main/resources/jwk.jwks

@@ -1,12 +1,12 @@
 {
   "keys": [
     {
-      "e": "AQAB",
-      "n": "h5xtDWLssoj5-WLCKPYPUDJlM5pnL4pS8-wMt9sVA57QVRVFdpWHi1dbDCugCApjvmD-giO5yjF5mQSTAF6a14FvktozVw_dDTEzrjG5FgT6WpMzMZd6JpiwQLOtEbV7oBkKYWm1vh1C67-xTlhKgQUNLVNDg4RqRcKFxZd5JPc",
       "kty": "RSA",
+	  "e": "AQAB",
       "use": "sig",
+      "kid": "maxkey_rsa",
       "alg": "RS256",
-      "kid": "connsec_rsa"
+      "n": "vyfZwQuBLNvJDhmziUCFuAfIv-bC6ivodcR6PfanTt8XLd6G63Yx10YChAdsDACjoLz1tEU56WPp_ee_vcTSsEZT3ouWJYghuGI2j4XclXlEj0S7DzdpcBBpI4n5dr8K3iKY-3JUMZR1AMBHI50UaMST9ZTZJAjUPIYxkhRdca5lWBo4wGUh1yj_80-Bq6al0ia9S5NTzNLaJ18jSxFqZ79BAkBm-KjkP248YUk6WBGtYEAV5Fws4dpse4hrqJ3RRHiMZV1o1iTmPHz_l55ZSDP3vpYf6iKqKzoK2RmdjfH5mGpbc4-PclTs4GKfwZ7cWfrny6B7sMnQfzujCH996Q"
     }
   ]
 }

+ 6 - 5
maxkey-demos/maxkey-demo-jwt/src/main/webapp/jwtcallback.jsp

@@ -14,12 +14,11 @@
 <%@ page language="java" import="com.google.gson.*" %>
 
 
-
 <%
 String path = request.getContextPath();
 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 String token=request.getParameter("jwt");
-System.out.println(token);
+System.out.println("jwt "+token);
 SignedJWT signedJWT=null;
 
 //JWKSetKeyStore jwkSetKeyStore=new JWKSetKeyStore();
@@ -27,15 +26,17 @@ SignedJWT signedJWT=null;
 File jwksFile=new File(PathUtils.getInstance().getClassPath()+"jwk.jwks");
 JWKSet jwkSet=JWKSet.load(jwksFile);
 
-RSASSAVerifier rsaSSAVerifier = new RSASSAVerifier(((RSAKey) jwkSet.getKeyByKeyId("connsec_rsa")).toRSAPublicKey());
+RSASSAVerifier rsaSSAVerifier = new RSASSAVerifier(((RSAKey) jwkSet.getKeyByKeyId("maxkey_rsa")).toRSAPublicKey());
 try {
 
     signedJWT = SignedJWT.parse(token);
 } catch (java.text.ParseException e) {
     // Invalid signed JWT encoding
 }
-;
-ReadOnlyJWTClaimsSet jwtClaims =signedJWT.getJWTClaimsSet();
+
+System.out.println("signedJWT "+signedJWT);
+
+JWTClaimsSet jwtClaims =signedJWT.getJWTClaimsSet();
  
 %>
 

+ 0 - 45
maxkey-demos/maxkey-demo-oauth/src/main/webapp/oauth10aindex.jsp

@@ -1,45 +0,0 @@
-<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
-<%@ page language="java" import="org.maxkey.client.oauth.oauth.*" %>
-<%@ page language="java" import="org.maxkey.client.oauth.builder.*" %>
-<%@ page language="java" import="org.maxkey.client.oauth.builder.api.ConnsecApi10a" %>
-<%@ page language="java" import="org.maxkey.client.oauth.model.Token" %>
-
-<%
-String path = request.getContextPath();
-String basePath = request.getScheme()+"://"+request.getServerName()+path+"/";
-String callback="http://oauth.demo.connsec.com:8080/oauthdemo/callback.jsp";
-OAuthService service = new ServiceBuilder()
-                            .provider(ConnsecApi10a.class)
-                            .apiKey("a08d486a-2007-4436-aeda-4310e9443ec7")
-                            .apiSecret("k3I2MTQxMjIwMTQxMDMxNTM4NzQW27")
-                            .callback(callback)
-                            .build();
-                            
-Token requestToken = service.getRequestToken();
-
-request.getSession().setAttribute("requestToken", requestToken);
-
-request.getSession().setAttribute("oauthv10aservice", service);
-
-%>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <base href="<%=basePath%>">
-    
-    <title>My JSP 'index.jsp' starting page</title>
-	<meta http-equiv="pragma" content="no-cache">
-	<meta http-equiv="cache-control" content="no-cache">
-	<meta http-equiv="expires" content="0">    
-	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
-	<meta http-equiv="description" content="This is my page">
-	<!--
-	<link rel="stylesheet" type="text/css" href="styles.css">
-	-->
-  </head>
-  
-  <body>
-    <a href="<%=service.getAuthorizationUrl(requestToken) %>&approval_prompt=auto">oauth sso</a>
-  </body>
-</html>

+ 1 - 1
maxkey-demos/maxkey-demo-oauth/src/main/webapp/oauth20callback.jsp

@@ -13,7 +13,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
 OAuthService service = (OAuthService)request.getSession().getAttribute("oauthv20service");
 
 if(service==null){
-	String callback="http://oauth.demo.connsec.com:8080/oauthdemo/oauth20callback.jsp";
+	String callback="http://oauthdemo.maxkey.org:8080/oauthdemo/oauth20callback.jsp";
 	service = new ServiceBuilder()
      .provider(ConnsecApi20.class)
      .apiKey("b32834accb544ea7a9a09dcae4a36403")

+ 1 - 1
maxkey-demos/maxkey-demo-oauth/src/main/webapp/oauth20index.jsp

@@ -8,7 +8,7 @@
 String path = request.getContextPath();
 String basePath = request.getScheme()+"://"+request.getServerName()+path+"/";
 
-String callback="http://oauth.demo.connsec.com:8080/oauthdemo/oauth20callback.jsp";
+String callback="http://oauthdemo.maxkey.org:8080/oauthdemo/oauth20callback.jsp";
 OAuthService service = new ServiceBuilder()
                             .provider(ConnsecApi20.class)
                             .apiKey("b32834accb544ea7a9a09dcae4a36403")

+ 1 - 1
maxkey-demos/maxkey-demo-oauth/src/main/webapp/oidc10callback.jsp

@@ -24,7 +24,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
 OAuthService service = (OAuthService)request.getSession().getAttribute("oauthv20service");
 
 if(service==null){
-	String callback="http://oauth.demo.connsec.com:8080/oauthdemo/oidc10callback.jsp";
+	String callback="http://oauthdemo.maxkey.org:8080/oauthdemo/oidc10callback.jsp";
 	service = new ServiceBuilder()
      .provider(ConnsecApi20.class)
      .apiKey("ae20330a-ef0b-4dad-9f10-d5e3485ca2ad")

BIN
maxkey-lib/db/mybatis-jpa-extra-1.0.jar


+ 12 - 26
maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/AuthorizeBaseEndpoint.java

@@ -3,7 +3,7 @@
  */
 package org.maxkey.authz.endpoint;
 
-import org.maxkey.constants.PROTOCOLS;
+import org.maxkey.config.ApplicationConfig;
 import org.maxkey.crypto.ReciprocalUtils;
 import org.maxkey.dao.service.AccountsService;
 import org.maxkey.dao.service.ApplicationsService;
@@ -28,23 +28,20 @@ public class AuthorizeBaseEndpoint {
 	@Qualifier("applicationsService")
 	protected ApplicationsService applicationsService;
 	
+	@Autowired 
+  	@Qualifier("applicationConfig")
+  	protected ApplicationConfig applicationConfig;
+	
 	@Autowired
-	AccountsService appAccountsService;
+	AccountsService accountsService;
 	
 	
-	protected Applications getApp(String id){
-		Applications  application=null;
-		if(id.equals("manage")){
-			application =new Applications();
-			application.setId("manage");
-			application.setName("Manage App");
-			application.setProtocol(PROTOCOLS.TOKENBASED);
-			application.setIsAdapter(1);
-			application.setAdapter("com.connsec.web.authorize.endpoint.adapter.TokenBasedJWTAdapter");
-		}else{
-			application=applicationsService.get(id);
+	protected Applications getApplication(String id){
+		Applications  application=(Applications)WebContext.getAttribute(AuthorizeBaseEndpoint.class.getName());
+		//session中为空或者id不一致重新加载
+		if(application==null||!application.getId().equalsIgnoreCase(id)) {
+			application=applicationsService.get(id);		
 		}
-		
 		if(application	==	null){
 			_logger.error("Applications for id "+id + "  is null");
 		}
@@ -52,23 +49,12 @@ public class AuthorizeBaseEndpoint {
 		return application;
 	}
 	
-	protected Applications getSessionApplication(String id){
-		Object object= WebContext.getAttribute(AuthorizeBaseEndpoint.class.getName());
-		Applications  application=null;
-		if(object	!=	null){
-			application	=	(Applications)object;
-		}else{
-			application	=	getApp(id);
-		}
-		return application;
-	}
-	
 	protected Accounts getAppAccounts(Applications application){
 		Accounts appAccount=new Accounts();
 		UserInfo userInfo=WebContext.getUserInfo();
 		if(application.getCredential()==Applications.CREDENTIALS.USER_DEFINED){
 			
-			appAccount=appAccountsService.load(new Accounts(userInfo.getId(),application.getId()));
+			appAccount=accountsService.load(new Accounts(userInfo.getId(),application.getId()));
 			if(appAccount!=null){
 				appAccount.setRelatedPassword(ReciprocalUtils.decoder(appAccount.getRelatedPassword()));
 			}

+ 2 - 2
maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/AuthorizeCredentialEndpoint.java

@@ -55,12 +55,12 @@ public class AuthorizeCredentialEndpoint extends AuthorizeBaseEndpoint{
 			appUser.setDisplayName(userInfo.getDisplayName());
 			
 			appUser.setAppId(appId);
-			appUser.setAppName(getSessionApplication(appId).getName());
+			appUser.setAppName(getApplication(appId).getName());
 			
 			appUser.setRelatedUsername(identity_username);
 			appUser.setRelatedPassword(ReciprocalUtils.encode(identity_password));
 			
-			if(appAccountsService.insert(appUser)){
+			if(accountsService.insert(appUser)){
 				
 			}
 		}

+ 12 - 40
maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/AuthorizeEndpoint.java

@@ -6,9 +6,7 @@ package org.maxkey.authz.endpoint;
 import javax.servlet.http.HttpServletRequest;
 
 import org.maxkey.authz.oauth2.provider.ClientDetailsService;
-import org.maxkey.client.oauth.builder.ServiceBuilder;
-import org.maxkey.client.oauth.builder.api.ConnsecApi20;
-import org.maxkey.client.oauth.oauth.OAuthService;
+import org.maxkey.client.utils.HttpEncoder;
 import org.maxkey.constants.PROTOCOLS;
 import org.maxkey.dao.service.CasDetailsService;
 import org.maxkey.domain.apps.Applications;
@@ -28,7 +26,8 @@ import org.springframework.web.servlet.ModelAndView;
  */
 @Controller
 public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
-
+	private static final String OAUTH_V20_AUTHORIZATION_URL = "%s/oauth/v20/authorize?client_id=%s&response_type=code&redirect_uri=%s&approval_prompt=auto";
+	
 	@Autowired
 	@Qualifier("oauth20JdbcClientDetailsService")
 	private ClientDetailsService clientDetailsService;
@@ -44,65 +43,38 @@ public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
 		
 		ModelAndView modelAndView=null;
 		
-		Applications  application=getApp(id);
+		Applications  application=getApplication(id);
 		WebContext.setAttribute(WebConstants.SINGLE_SIGN_ON_APP_ID, id);
 		
 		if(application.getProtocol().equalsIgnoreCase(PROTOCOLS.EXTEND_API)){
-			
 			modelAndView=WebContext.forward("/authz/api/"+id);
-			
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.FORMBASED)){
-			
 			 modelAndView=WebContext.forward("/authz/formbased/"+id);
-			 
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.OAUTH20)){
 			ClientDetails  clientDetails =clientDetailsService.loadClientByClientId(application.getId());
-			OAuthService service = new ServiceBuilder()
-	        .provider(ConnsecApi20.class)
-	        .apiKey(application.getId())
-	        .apiSecret(application.getSecret())
-	        .callback(clientDetails.getRegisteredRedirectUri().toArray()[0].toString())
-	        .build();
 			_logger.debug(""+clientDetails);
+			String authorizationUrl = String.format(OAUTH_V20_AUTHORIZATION_URL, 
+							applicationConfig.getServerPrefix(),
+							clientDetails.getClientId(), 
+							HttpEncoder.encode(clientDetails.getRegisteredRedirectUri().toArray()[0].toString())
+					);
 			
-			String authorizationUrl = service.getAuthorizationUrl(null);
-			modelAndView=WebContext.redirect(authorizationUrl);
-			 
-		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.OAUTH10A)){
-			/*
-			 * Application must get request_token for authn
-			 */
-			modelAndView=WebContext.forward("/authz/oauth10a/"+id);
+			_logger.debug("authorizationUrl "+authorizationUrl);
 			
+			modelAndView=WebContext.redirect(authorizationUrl);
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.OPEN_ID_CONNECT)){
-			
 			// modelAndView=new ModelAndView("openid connect");
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.SAML20)){
-			
 			 modelAndView=WebContext.forward("/authz/saml20/idpinit/"+application.getId());
-			 
-		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.SAML11)){
-			
-			modelAndView=WebContext.forward("/authz/saml11/idpinit/"+application.getId());
-			 
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.TOKENBASED)){
-			
 			modelAndView=WebContext.forward("/authorize/tokenbased/"+id);
-			
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.LTPA)){
-			
 			modelAndView=WebContext.forward("/authz/ltpa/"+id);
-			
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.CAS)){
-			
 			modelAndView=WebContext.forward("/authz/cas/"+id);
-			
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.DESKTOP)){
-			
 			modelAndView=WebContext.forward("/authz/desktop/"+id);
-			
 		}else if (application.getProtocol().equalsIgnoreCase(PROTOCOLS.BASIC)){
-			
 			modelAndView=WebContext.redirect(application.getLoginUrl());
 		}
 		
@@ -115,7 +87,7 @@ public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
 	public ModelAndView authorizeOAuth10a(
 			@PathVariable("id") String id){
 		
-		 String redirec_uri=getApp(id).getLoginUrl();
+		 String redirec_uri=getApplication(id).getLoginUrl();
 		return WebContext.redirect(redirec_uri);
 		
 	}

+ 0 - 1
maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/CasAuthorizeEndpoint.java

@@ -91,7 +91,6 @@ public class CasAuthorizeEndpoint  extends AuthorizeBaseEndpoint{
 		CasDetails casDetails=(CasDetails)WebContext.getAttribute(CasConstants.PARAMETER.ENDPOINT_CAS_DETAILS);
 		ServiceTicketImpl serviceTicket=new ServiceTicketImpl(WebContext.getAuthentication(),casDetails);
 		
-		//InMemoryTicketServices
 		String ticket=ticketServices.createTicket(serviceTicket);
 		
 		return WebContext.redirect(casDetails.getService()+"?"+CasConstants.PARAMETER.TICKET+"="+ticket);

+ 2 - 2
maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/ExtendApiAuthorizeEndpoint.java

@@ -30,7 +30,7 @@ public class ExtendApiAuthorizeEndpoint  extends AuthorizeBaseEndpoint{
 	@RequestMapping("/authz/api/{id}")
 	public ModelAndView authorize(HttpServletRequest request,@PathVariable("id") String id){
 		
-		Applications apps=getApp(id);
+		Applications apps=getApplication(id);
 		_logger.debug(""+apps);
 		
 		if(BOOLEAN.isTrue(apps.getIsAdapter())){
@@ -53,7 +53,7 @@ public class ExtendApiAuthorizeEndpoint  extends AuthorizeBaseEndpoint{
 					modelAndView);
 			return modelAndView;
 		}else{
-			String redirec_uri=getApp(id).getLoginUrl();
+			String redirec_uri=getApplication(id).getLoginUrl();
 			return WebContext.redirect(redirec_uri);
 		}
 		

+ 4 - 1
maxkey-protocols/maxkey-protocol-ltpa/src/main/java/org/maxkey/authz/ltpa/endpoint/LtpaAuthorizeEndpoint.java

@@ -83,7 +83,10 @@ public class LtpaAuthorizeEndpoint  extends AuthorizeBaseEndpoint{
 		cookie.setMaxAge(maxAge);
 		
 		cookie.setPath("/");
-		cookie.setDomain("."+applicationConfig.getSubDomainName());
+		//
+		//cookie.setDomain("."+applicationConfig.getSubDomainName());
+		//tomcat 8.5
+		cookie.setDomain(applicationConfig.getSubDomainName());
 		
 		_logger.debug("Sub Domain Name : "+"."+applicationConfig.getSubDomainName());
 		response.addCookie(cookie);

+ 18 - 0
maxkey-protocols/maxkey-protocol-oauth-2.0/json-web-key-generator/Usage.txt

@@ -0,0 +1,18 @@
+Usage
+Invoking the utility without arguments will print its usage message
+
+usage java -jar json-web-key-generator.jar -t keyType [options]
+ -a arg   Algorithm (optional)
+ -c arg   Key Curve, required for EC key type. Must be one of P-256,
+            P-384, P-521
+ -i arg   Key ID (optional)
+ -p         Display public key separately
+ -s arg   Key Size in bits, required for RSA and OCT key types. Must be
+            an integer divisible by 8
+ -S         Wrap the generated key in a KeySet
+ -t arg   Key Type, one of RSA, oct, EC
+ -u arg   Usage, one of enc, sig (optional)
+Example
+To generate a 2048-bit RSA public  private key pair, with a specified key ID and use, and wrapped in a standard JWK set
+
+java -jar json-web-key-generator.jar -t RSA -s 2048 -i 1 -u sig -S

+ 2 - 0
maxkey-protocols/maxkey-protocol-oauth-2.0/json-web-key-generator/json-web-key-generator.bat

@@ -0,0 +1,2 @@
+java -jar json-web-key-generator.jar -a RS256 -t RSA -s 2048 -i maxkey_rsa -u sig -S >maxkey.jwks
+pause

BIN
maxkey-protocols/maxkey-protocol-oauth-2.0/json-web-key-generator/json-web-key-generator.jar


+ 14 - 0
maxkey-protocols/maxkey-protocol-oauth-2.0/json-web-key-generator/maxkey.jwks

@@ -0,0 +1,14 @@
+Full key:
+{
+  "keys": [
+    {
+      "kty": "RSA",
+      "d": "K2VCm_6enq5uoFLZXUlWkgbCXj5m9X5uUX3_Ol3qcY9X1cP04TN98R8lpw-ASeFDRFRhe0FT-lYCYu_fqZcrNXVhyN3rgi27af5x4HdFMnHLTLMPvE6aEyTGmZjTF1AbiX5VOJAl6POI9FiyTbV1Uqt943ydJv8SH4NfcYhKBmpp8Fi1f58mon-bYwsIy8mzZjssc8KZy-GzpscKrc5ewb7106JY3uRQNprAHrpcGAPZ8uXUvVhrxp_FNn5Nf5KVxl2tm50L83_5nw0OZrbJ8Ceg7sZAw_Z41lbYbS9VDaST6TuKRb7W4XCKimZUn57LoQT2-Gkv6msJHCmqTgK02Q",
+      "e": "AQAB",
+      "use": "sig",
+      "kid": "maxkey_rsa",
+      "alg": "RS256",
+      "n": "vyfZwQuBLNvJDhmziUCFuAfIv-bC6ivodcR6PfanTt8XLd6G63Yx10YChAdsDACjoLz1tEU56WPp_ee_vcTSsEZT3ouWJYghuGI2j4XclXlEj0S7DzdpcBBpI4n5dr8K3iKY-3JUMZR1AMBHI50UaMST9ZTZJAjUPIYxkhRdca5lWBo4wGUh1yj_80-Bq6al0ia9S5NTzNLaJ18jSxFqZ79BAkBm-KjkP248YUk6WBGtYEAV5Fws4dpse4hrqJ3RRHiMZV1o1iTmPHz_l55ZSDP3vpYf6iKqKzoK2RmdjfH5mGpbc4-PclTs4GKfwZ7cWfrny6B7sMnQfzujCH996Q"
+    }
+  ]
+}

+ 0 - 3
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/META-INF/MANIFEST.MF

@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path: 
-

+ 0 - 118
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/AbstractOAuth2Token.java

@@ -1,118 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import org.springframework.lang.Nullable;
-import org.springframework.security.core.SpringSecurityCoreVersion;
-import org.springframework.util.Assert;
-
-import java.io.Serializable;
-import java.time.Instant;
-
-/**
- * Base class for OAuth 2.0 Token implementations.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see OAuth2AccessToken
- */
-public abstract class AbstractOAuth2Token implements Serializable {
-	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-	private final String tokenValue;
-	private final Instant issuedAt;
-	private final Instant expiresAt;
-
-	/**
-	 * Sub-class constructor.
-	 *
-	 * @param tokenValue the token value
-	 */
-	protected AbstractOAuth2Token(String tokenValue) {
-		this(tokenValue, null, null);
-	}
-
-	/**
-	 * Sub-class constructor.
-	 *
-	 * @param tokenValue the token value
-	 * @param issuedAt the time at which the token was issued, may be null
-	 * @param expiresAt the expiration time on or after which the token MUST NOT be accepted, may be null
-	 */
-	protected AbstractOAuth2Token(String tokenValue, @Nullable Instant issuedAt, @Nullable Instant expiresAt) {
-		Assert.hasText(tokenValue, "tokenValue cannot be empty");
-		if (issuedAt != null && expiresAt != null) {
-			Assert.isTrue(expiresAt.isAfter(issuedAt), "expiresAt must be after issuedAt");
-		}
-		this.tokenValue = tokenValue;
-		this.issuedAt = issuedAt;
-		this.expiresAt = expiresAt;
-	}
-
-	/**
-	 * Returns the token value.
-	 *
-	 * @return the token value
-	 */
-	public String getTokenValue() {
-		return this.tokenValue;
-	}
-
-	/**
-	 * Returns the time at which the token was issued.
-	 *
-	 * @return the time the token was issued or null
-	 */
-	public @Nullable Instant getIssuedAt() {
-		return this.issuedAt;
-	}
-
-	/**
-	 * Returns the expiration time on or after which the token MUST NOT be accepted.
-	 *
-	 * @return the expiration time of the token or null
-	 */
-	public @Nullable Instant getExpiresAt() {
-		return this.expiresAt;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj) {
-			return true;
-		}
-		if (obj == null || this.getClass() != obj.getClass()) {
-			return false;
-		}
-
-		AbstractOAuth2Token that = (AbstractOAuth2Token) obj;
-
-		if (!this.getTokenValue().equals(that.getTokenValue())) {
-			return false;
-		}
-		if (this.getIssuedAt() != null ? !this.getIssuedAt().equals(that.getIssuedAt()) : that.getIssuedAt() != null) {
-			return false;
-		}
-		return this.getExpiresAt() != null ? this.getExpiresAt().equals(that.getExpiresAt()) : that.getExpiresAt() == null;
-	}
-
-	@Override
-	public int hashCode() {
-		int result = this.getTokenValue().hashCode();
-		result = 31 * result + (this.getIssuedAt() != null ? this.getIssuedAt().hashCode() : 0);
-		result = 31 * result + (this.getExpiresAt() != null ? this.getExpiresAt().hashCode() : 0);
-		return result;
-	}
-}

+ 0 - 72
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/AuthenticationMethod.java

@@ -1,72 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import java.io.Serializable;
-
-import org.springframework.security.core.SpringSecurityCoreVersion;
-import org.springframework.util.Assert;
-
-/**
- * The authentication method used when sending bearer access tokens in resource requests to resource servers.
- *
- * @author MyeongHyeon Lee
- * @since 5.1
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6750#section-2">Section 2 Authenticated Requests</a>
- */
-public final class AuthenticationMethod implements Serializable {
-	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-	public static final AuthenticationMethod HEADER = new AuthenticationMethod("header");
-	public static final AuthenticationMethod FORM = new AuthenticationMethod("form");
-	public static final AuthenticationMethod QUERY = new AuthenticationMethod("query");
-	private final String value;
-
-	/**
-	 * Constructs an {@code AuthenticationMethod} using the provided value.
-	 *
-	 * @param value the value of the authentication method type
-	 */
-	public AuthenticationMethod(String value) {
-		Assert.hasText(value, "value cannot be empty");
-		this.value = value;
-	}
-
-	/**
-	 * Returns the value of the authentication method type.
-	 *
-	 * @return the value of the authentication method type
-	 */
-	public String getValue() {
-		return this.value;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj) {
-			return true;
-		}
-		if (obj == null || this.getClass() != obj.getClass()) {
-			return false;
-		}
-		AuthenticationMethod that = (AuthenticationMethod) obj;
-		return this.getValue().equals(that.getValue());
-	}
-
-	@Override
-	public int hashCode() {
-		return this.getValue().hashCode();
-	}
-}

+ 0 - 79
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/AuthorizationGrantType.java

@@ -1,79 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import org.springframework.security.core.SpringSecurityCoreVersion;
-import org.springframework.util.Assert;
-
-import java.io.Serializable;
-
-/**
- * An authorization grant is a credential representing the resource owner's authorization
- * (to access it's protected resources) to the client and used by the client to obtain an access token.
- *
- * <p>
- * The OAuth 2.0 Authorization Framework defines four standard grant types:
- * authorization code, implicit, resource owner password credentials, and client credentials.
- * It also provides an extensibility mechanism for defining additional grant types.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-1.3">Section 1.3 Authorization Grant</a>
- */
-public final class AuthorizationGrantType implements Serializable {
-	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-	public static final AuthorizationGrantType AUTHORIZATION_CODE = new AuthorizationGrantType("authorization_code");
-	public static final AuthorizationGrantType IMPLICIT = new AuthorizationGrantType("implicit");
-	public static final AuthorizationGrantType REFRESH_TOKEN = new AuthorizationGrantType("refresh_token");
-	public static final AuthorizationGrantType CLIENT_CREDENTIALS = new AuthorizationGrantType("client_credentials");
-	private final String value;
-
-	/**
-	 * Constructs an {@code AuthorizationGrantType} using the provided value.
-	 *
-	 * @param value the value of the authorization grant type
-	 */
-	public AuthorizationGrantType(String value) {
-		Assert.hasText(value, "value cannot be empty");
-		this.value = value;
-	}
-
-	/**
-	 * Returns the value of the authorization grant type.
-	 *
-	 * @return the value of the authorization grant type
-	 */
-	public String getValue() {
-		return this.value;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj) {
-			return true;
-		}
-		if (obj == null || this.getClass() != obj.getClass()) {
-			return false;
-		}
-		AuthorizationGrantType that = (AuthorizationGrantType) obj;
-		return this.getValue().equals(that.getValue());
-	}
-
-	@Override
-	public int hashCode() {
-		return this.getValue().hashCode();
-	}
-}

+ 0 - 153
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/ClaimAccessor.java

@@ -1,153 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import org.springframework.util.Assert;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * An &quot;accessor&quot; for a set of claims that may be used for assertions.
- *
- * @author Joe Grandja
- * @since 5.0
- */
-public interface ClaimAccessor {
-
-	/**
-	 * Returns a set of claims that may be used for assertions.
-	 *
-	 * @return a {@code Map} of claims
-	 */
-	Map<String, Object> getClaims();
-
-	/**
-	 * Returns {@code true} if the claim exists in {@link #getClaims()}, otherwise {@code false}.
-	 *
-	 * @param claim the name of the claim
-	 * @return {@code true} if the claim exists, otherwise {@code false}
-	 */
-	default Boolean containsClaim(String claim) {
-		Assert.notNull(claim, "claim cannot be null");
-		return this.getClaims().containsKey(claim);
-	}
-
-	/**
-	 * Returns the claim value as a {@code String} or {@code null} if it does not exist or is equal to {@code null}.
-	 *
-	 * @param claim the name of the claim
-	 * @return the claim value or {@code null} if it does not exist or is equal to {@code null}
-	 */
-	default String getClaimAsString(String claim) {
-		if (!this.containsClaim(claim)) {
-			return null;
-		}
-		Object claimValue = this.getClaims().get(claim);
-		return (claimValue != null ? claimValue.toString() : null);
-	}
-
-	/**
-	 * Returns the claim value as a {@code Boolean} or {@code null} if it does not exist.
-	 *
-	 * @param claim the name of the claim
-	 * @return the claim value or {@code null} if it does not exist
-	 */
-	default Boolean getClaimAsBoolean(String claim) {
-		return (this.containsClaim(claim) ? Boolean.valueOf(this.getClaimAsString(claim)) : null);
-	}
-
-	/**
-	 * Returns the claim value as an {@code Instant} or {@code null} if it does not exist.
-	 *
-	 * @param claim the name of the claim
-	 * @return the claim value or {@code null} if it does not exist
-	 */
-	default Instant getClaimAsInstant(String claim) {
-		if (!this.containsClaim(claim)) {
-			return null;
-		}
-		Object claimValue = this.getClaims().get(claim);
-		if (Long.class.isAssignableFrom(claimValue.getClass()) ||
-				Integer.class.isAssignableFrom(claimValue.getClass()) ||
-				Double.class.isAssignableFrom(claimValue.getClass())) {
-			return Instant.ofEpochSecond(((Number) claimValue).longValue());
-		}
-		if (Date.class.isAssignableFrom(claimValue.getClass())) {
-			return ((Date) claimValue).toInstant();
-		}
-		if (Instant.class.isAssignableFrom(claimValue.getClass())) {
-			return (Instant) claimValue;
-		}
-		throw new IllegalArgumentException("Unable to convert claim '" + claim +
-				"' of type '" + claimValue.getClass() + "' to Instant.");
-	}
-
-	/**
-	 * Returns the claim value as an {@code URL} or {@code null} if it does not exist.
-	 *
-	 * @param claim the name of the claim
-	 * @return the claim value or {@code null} if it does not exist
-	 */
-	default URL getClaimAsURL(String claim) {
-		if (!this.containsClaim(claim)) {
-			return null;
-		}
-		try {
-			return new URL(this.getClaimAsString(claim));
-		} catch (MalformedURLException ex) {
-			throw new IllegalArgumentException("Unable to convert claim '" + claim + "' to URL: " + ex.getMessage(), ex);
-		}
-	}
-
-	/**
-	 * Returns the claim value as a {@code Map<String, Object>}
-	 * or {@code null} if it does not exist or cannot be assigned to a {@code Map}.
-	 *
-	 * @param claim the name of the claim
-	 * @return the claim value or {@code null} if it does not exist or cannot be assigned to a {@code Map}
-	 */
-	default Map<String, Object> getClaimAsMap(String claim) {
-		if (!this.containsClaim(claim) || !Map.class.isAssignableFrom(this.getClaims().get(claim).getClass())) {
-			return null;
-		}
-		Map<String, Object> claimValues = new HashMap<>();
-		((Map<?, ?>) this.getClaims().get(claim)).forEach((k, v) -> claimValues.put(k.toString(), v));
-		return claimValues;
-	}
-
-	/**
-	 * Returns the claim value as a {@code List<String>}
-	 * or {@code null} if it does not exist or cannot be assigned to a {@code List}.
-	 *
-	 * @param claim the name of the claim
-	 * @return the claim value or {@code null} if it does not exist or cannot be assigned to a {@code List}
-	 */
-	default List<String> getClaimAsStringList(String claim) {
-		if (!this.containsClaim(claim) || !List.class.isAssignableFrom(this.getClaims().get(claim).getClass())) {
-			return null;
-		}
-		List<String> claimValues = new ArrayList<>();
-		((List<?>) this.getClaims().get(claim)).forEach(e -> claimValues.add(e.toString()));
-		return claimValues;
-	}
-}

+ 0 - 77
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/ClientAuthenticationMethod.java

@@ -1,77 +0,0 @@
-/*
- * Copyright 2002-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import org.springframework.security.core.SpringSecurityCoreVersion;
-import org.springframework.util.Assert;
-
-import java.io.Serializable;
-
-/**
- * The authentication method used when authenticating the client with the authorization server.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-2.3">Section 2.3 Client Authentication</a>
- */
-public final class ClientAuthenticationMethod implements Serializable {
-	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-	public static final ClientAuthenticationMethod BASIC = new ClientAuthenticationMethod("basic");
-	public static final ClientAuthenticationMethod POST = new ClientAuthenticationMethod("post");
-
-	/**
-	 * @since 5.2
-	 */
-	public static final ClientAuthenticationMethod NONE = new ClientAuthenticationMethod("none");
-
-	private final String value;
-
-	/**
-	 * Constructs a {@code ClientAuthenticationMethod} using the provided value.
-	 *
-	 * @param value the value of the client authentication method
-	 */
-	public ClientAuthenticationMethod(String value) {
-		Assert.hasText(value, "value cannot be empty");
-		this.value = value;
-	}
-
-	/**
-	 * Returns the value of the client authentication method.
-	 *
-	 * @return the value of the client authentication method
-	 */
-	public String getValue() {
-		return this.value;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj) {
-			return true;
-		}
-		if (obj == null || this.getClass() != obj.getClass()) {
-			return false;
-		}
-		ClientAuthenticationMethod that = (ClientAuthenticationMethod) obj;
-		return this.getValue().equalsIgnoreCase(that.getValue());
-	}
-
-	@Override
-	public int hashCode() {
-		return this.getValue().hashCode();
-	}
-}

+ 0 - 72
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/DelegatingOAuth2TokenValidator.java

@@ -1,72 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.oauth2.core;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.springframework.util.Assert;
-
-/**
- * A composite validator
- *
- * @param <T> the type of {@link AbstractOAuth2Token} this validator validates
- *
- * @author Josh Cummings
- * @since 5.1
- */
-public final class DelegatingOAuth2TokenValidator<T extends AbstractOAuth2Token>
-		implements OAuth2TokenValidator<T> {
-
-	private final Collection<OAuth2TokenValidator<T>> tokenValidators;
-
-	/**
-	 * Constructs a {@code DelegatingOAuth2TokenValidator} using the provided validators.
-	 *
-	 * @param tokenValidators the {@link Collection} of {@link OAuth2TokenValidator}s to use
-	 */
-	public DelegatingOAuth2TokenValidator(Collection<OAuth2TokenValidator<T>> tokenValidators) {
-		Assert.notNull(tokenValidators, "tokenValidators cannot be null");
-
-		this.tokenValidators = new ArrayList<>(tokenValidators);
-	}
-
-	/**
-	 * Constructs a {@code DelegatingOAuth2TokenValidator} using the provided validators.
-	 *
-	 * @param tokenValidators the collection of {@link OAuth2TokenValidator}s to use
-	 */
-	@SafeVarargs
-	public DelegatingOAuth2TokenValidator(OAuth2TokenValidator<T>... tokenValidators) {
-		this(Arrays.asList(tokenValidators));
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public OAuth2TokenValidatorResult validate(T token) {
-		Collection<OAuth2Error> errors = new ArrayList<>();
-
-		for ( OAuth2TokenValidator<T> validator : this.tokenValidators) {
-			errors.addAll(validator.validate(token).getErrors());
-		}
-
-		return OAuth2TokenValidatorResult.failure(errors);
-	}
-}

+ 0 - 131
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2AccessToken.java

@@ -1,131 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import org.springframework.security.core.SpringSecurityCoreVersion;
-import org.springframework.util.Assert;
-
-import java.io.Serializable;
-import java.time.Instant;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * An implementation of an {@link AbstractOAuth2Token} representing an OAuth 2.0 Access Token.
- *
- * <p>
- * An access token is a credential that represents an authorization
- * granted by the resource owner to the client.
- * It is primarily used by the client to access protected resources on either a
- * resource server or the authorization server that originally issued the access token.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-1.4">Section 1.4 Access Token</a>
- */
-public class OAuth2AccessToken extends AbstractOAuth2Token {
-	private final TokenType tokenType;
-	private final Set<String> scopes;
-
-	/**
-	 * Constructs an {@code OAuth2AccessToken} using the provided parameters.
-	 *
-	 * @param tokenType the token type
-	 * @param tokenValue the token value
-	 * @param issuedAt the time at which the token was issued
-	 * @param expiresAt the expiration time on or after which the token MUST NOT be accepted
-	 */
-	public OAuth2AccessToken(TokenType tokenType, String tokenValue, Instant issuedAt, Instant expiresAt) {
-		this(tokenType, tokenValue, issuedAt, expiresAt, Collections.emptySet());
-	}
-
-	/**
-	 * Constructs an {@code OAuth2AccessToken} using the provided parameters.
-	 *
-	 * @param tokenType the token type
-	 * @param tokenValue the token value
-	 * @param issuedAt the time at which the token was issued
-	 * @param expiresAt the expiration time on or after which the token MUST NOT be accepted
-	 * @param scopes the scope(s) associated to the token
-	 */
-	public OAuth2AccessToken(TokenType tokenType, String tokenValue, Instant issuedAt, Instant expiresAt, Set<String> scopes) {
-		super(tokenValue, issuedAt, expiresAt);
-		Assert.notNull(tokenType, "tokenType cannot be null");
-		this.tokenType = tokenType;
-		this.scopes = Collections.unmodifiableSet(
-			scopes != null ? scopes : Collections.emptySet());
-	}
-
-	/**
-	 * Returns the {@link TokenType token type}.
-	 *
-	 * @return the {@link TokenType}
-	 */
-	public TokenType getTokenType() {
-		return this.tokenType;
-	}
-
-	/**
-	 * Returns the scope(s) associated to the token.
-	 *
-	 * @return the scope(s) associated to the token
-	 */
-	public Set<String> getScopes() {
-		return this.scopes;
-	}
-
-	/**
-	 * Access Token Types.
-	 *
-	 * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-7.1">Section 7.1 Access Token Types</a>
-	 */
-	public static final class TokenType implements Serializable {
-		private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-		public static final TokenType BEARER = new TokenType("Bearer");
-		private final String value;
-
-		private TokenType(String value) {
-			Assert.hasText(value, "value cannot be empty");
-			this.value = value;
-		}
-
-		/**
-		 * Returns the value of the token type.
-		 *
-		 * @return the value of the token type
-		 */
-		public String getValue() {
-			return this.value;
-		}
-
-		@Override
-		public boolean equals(Object obj) {
-			if (this == obj) {
-				return true;
-			}
-			if (obj == null || this.getClass() != obj.getClass()) {
-				return false;
-			}
-			TokenType that = (TokenType) obj;
-			return this.getValue().equalsIgnoreCase(that.getValue());
-		}
-
-		@Override
-		public int hashCode() {
-			return this.getValue().hashCode();
-		}
-	}
-}

+ 0 - 98
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2AuthenticationException.java

@@ -1,98 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.util.Assert;
-
-/**
- * This exception is thrown for all OAuth 2.0 related {@link Authentication} errors.
- *
- * <p>
- * There are a number of scenarios where an error may occur, for example:
- * <ul>
- *  <li>The authorization request or token request is missing a required parameter</li>
- *	<li>Missing or invalid client identifier</li>
- *	<li>Invalid or mismatching redirection URI</li>
- *	<li>The requested scope is invalid, unknown, or malformed</li>
- *	<li>The resource owner or authorization server denied the access request</li>
- *	<li>Client authentication failed</li>
- *	<li>The provided authorization grant (authorization code, resource owner credentials) is invalid, expired, or revoked</li>
- * </ul>
- *
- * @author Joe Grandja
- * @since 5.0
- */
-public class OAuth2AuthenticationException extends AuthenticationException {
-	private OAuth2Error error;
-
-	/**
-	 * Constructs an {@code OAuth2AuthenticationException} using the provided parameters.
-	 *
-	 * @param error the {@link OAuth2Error OAuth 2.0 Error}
-	 */
-	public OAuth2AuthenticationException(OAuth2Error error) {
-		this(error, error.getDescription());
-	}
-
-	/**
-	 * Constructs an {@code OAuth2AuthenticationException} using the provided parameters.
-	 *
-	 * @param error the {@link OAuth2Error OAuth 2.0 Error}
-	 * @param cause the root cause
-	 */
-	public OAuth2AuthenticationException(OAuth2Error error, Throwable cause) {
-		this(error, cause.getMessage(), cause);
-	}
-
-	/**
-	 * Constructs an {@code OAuth2AuthenticationException} using the provided parameters.
-	 *
-	 * @param error the {@link OAuth2Error OAuth 2.0 Error}
-	 * @param message the detail message
-	 */
-	public OAuth2AuthenticationException(OAuth2Error error, String message) {
-		super(message);
-		this.setError(error);
-	}
-
-	/**
-	 * Constructs an {@code OAuth2AuthenticationException} using the provided parameters.
-	 *
-	 * @param error the {@link OAuth2Error OAuth 2.0 Error}
-	 * @param message the detail message
-	 * @param cause the root cause
-	 */
-	public OAuth2AuthenticationException(OAuth2Error error, String message, Throwable cause) {
-		super(message, cause);
-		this.setError(error);
-	}
-
-	/**
-	 * Returns the {@link OAuth2Error OAuth 2.0 Error}.
-	 *
-	 * @return the {@link OAuth2Error}
-	 */
-	public OAuth2Error getError() {
-		return this.error;
-	}
-
-	private void setError(OAuth2Error error) {
-		Assert.notNull(error, "error cannot be null");
-		this.error = error;
-	}
-}

+ 0 - 56
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2AuthorizationException.java

@@ -1,56 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-/**
- * Base exception for OAuth 2.0 Authorization errors.
- *
- * @author Joe Grandja
- * @since 5.1
- */
-public class OAuth2AuthorizationException extends RuntimeException {
-	private OAuth2Error error;
-
-	/**
-	 * Constructs an {@code OAuth2AuthorizationException} using the provided parameters.
-	 *
-	 * @param error the {@link OAuth2Error OAuth 2.0 Error}
-	 */
-	public OAuth2AuthorizationException(OAuth2Error error) {
-		super(error.toString());
-		this.error = error;
-	}
-
-	/**
-	 * Constructs an {@code OAuth2AuthorizationException} using the provided parameters.
-	 *
-	 * @param error the {@link OAuth2Error OAuth 2.0 Error}
-	 * @param cause the root cause
-	 */
-	public OAuth2AuthorizationException(OAuth2Error error, Throwable cause) {
-		super(error.toString(), cause);
-		this.error = error;
-	}
-
-	/**
-	 * Returns the {@link OAuth2Error OAuth 2.0 Error}.
-	 *
-	 * @return the {@link OAuth2Error}
-	 */
-	public OAuth2Error getError() {
-		return this.error;
-	}
-}

+ 0 - 98
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2Error.java

@@ -1,98 +0,0 @@
-/*
- * Copyright 2002-2017 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import org.springframework.security.core.SpringSecurityCoreVersion;
-import org.springframework.util.Assert;
-
-import java.io.Serializable;
-
-/**
- * A representation of an OAuth 2.0 Error.
- *
- * <p>
- * At a minimum, an error response will contain an error code.
- * The error code may be one of the standard codes defined by the specification,
- * or a new code defined in the OAuth Extensions Error Registry,
- * for cases where protocol extensions require additional error code(s) above the standard codes.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see OAuth2ErrorCodes
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-11.4">Section 11.4 OAuth Extensions Error Registry</a>
- */
-public class OAuth2Error implements Serializable {
-	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-	private final String errorCode;
-	private final String description;
-	private final String uri;
-
-	/**
-	 * Constructs an {@code OAuth2Error} using the provided parameters.
-	 *
-	 * @param errorCode the error code
-	 */
-	public OAuth2Error(String errorCode) {
-		this(errorCode, null, null);
-	}
-
-	/**
-	 * Constructs an {@code OAuth2Error} using the provided parameters.
-	 *
-	 * @param errorCode the error code
-	 * @param description the error description
-	 * @param uri the error uri
-	 */
-	public OAuth2Error(String errorCode, String description, String uri) {
-		Assert.hasText(errorCode, "errorCode cannot be empty");
-		this.errorCode = errorCode;
-		this.description = description;
-		this.uri = uri;
-	}
-
-	/**
-	 * Returns the error code.
-	 *
-	 * @return the error code
-	 */
-	public final String getErrorCode() {
-		return this.errorCode;
-	}
-
-	/**
-	 * Returns the error description.
-	 *
-	 * @return the error description
-	 */
-	public final String getDescription() {
-		return this.description;
-	}
-
-	/**
-	 * Returns the error uri.
-	 *
-	 * @return the error uri
-	 */
-	public final String getUri() {
-		return this.uri;
-	}
-
-	@Override
-	public String toString() {
-		return "[" + this.getErrorCode() + "] " +
-				(this.getDescription() != null ? this.getDescription() : "");
-	}
-}

+ 0 - 95
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2ErrorCodes.java

@@ -1,95 +0,0 @@
-/*
- * Copyright 2002-2017 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-/**
- * Standard error codes defined by the OAuth 2.0 Authorization Framework.
- *
- * @author Joe Grandja
- * @since 5.0
- */
-public interface OAuth2ErrorCodes {
-
-	/**
-	 * {@code invalid_request} - The request is missing a required parameter,
-	 * includes an invalid parameter value,
-	 * includes a parameter more than once, or is otherwise malformed.
-	 */
-	String INVALID_REQUEST = "invalid_request";
-
-	/**
-	 * {@code unauthorized_client} - The client is not authorized to request
-	 * an authorization code or access token using this method.
-	 */
-	String UNAUTHORIZED_CLIENT = "unauthorized_client";
-
-	/**
-	 * {@code access_denied} - The resource owner or authorization server denied the request.
-	 */
-	String ACCESS_DENIED = "access_denied";
-
-	/**
-	 * {@code unsupported_response_type} - The authorization server does not support
-	 * obtaining an authorization code or access token using this method.
-	 */
-	String UNSUPPORTED_RESPONSE_TYPE = "unsupported_response_type";
-
-	/**
-	 * {@code invalid_scope} - The requested scope is invalid, unknown, malformed or
-	 * exceeds the scope granted by the resource owner.
-	 */
-	String INVALID_SCOPE = "invalid_scope";
-
-	/**
-	 * {@code server_error} - The authorization server encountered an
-	 * unexpected condition that prevented it from fulfilling the request.
-	 * (This error code is needed because a 500 Internal Server Error HTTP status code
-	 * cannot be returned to the client via a HTTP redirect.)
-	 */
-	String SERVER_ERROR = "server_error";
-
-	/**
-	 * {@code temporarily_unavailable} - The authorization server is currently unable
-	 * to handle the request due to a temporary overloading or maintenance of the server.
-	 * (This error code is needed because a 503 Service Unavailable HTTP status code
-	 * cannot be returned to the client via an HTTP redirect.)
-	 */
-	String TEMPORARILY_UNAVAILABLE = "temporarily_unavailable";
-
-	/**
-	 * {@code invalid_client} - Client authentication failed (e.g., unknown client,
-	 * no client authentication included, or unsupported authentication method).
-	 * The authorization server MAY return a HTTP 401 (Unauthorized) status code
-	 * to indicate which HTTP authentication schemes are supported.
-	 * If the client attempted to authenticate via the &quot;Authorization&quot; request header field,
-	 * the authorization server MUST respond with a HTTP 401 (Unauthorized) status code and
-	 * include the &quot;WWW-Authenticate&quot; response header field matching the authentication scheme used by the client.
-	 */
-	String INVALID_CLIENT = "invalid_client";
-
-	/**
-	 * {@code invalid_grant} - The provided authorization grant
-	 * (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked,
-	 * does not match the redirection URI used in the authorization request, or was issued to another client.
-	 */
-	String INVALID_GRANT = "invalid_grant";
-
-	/**
-	 * {@code unsupported_grant_type} - The authorization grant type is not supported by the authorization server.
-	 */
-	String UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type";
-
-}

+ 0 - 45
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2RefreshToken.java

@@ -1,45 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-import java.time.Instant;
-
-/**
- * An implementation of an {@link AbstractOAuth2Token} representing an OAuth 2.0 Refresh Token.
- *
- * <p>
- * A refresh token is a credential that represents an authorization
- * granted by the resource owner to the client.
- * It is used by the client to obtain a new access token when the current access token
- * becomes invalid or expires, or to obtain additional access tokens with identical or narrower scope.
- *
- * @author Joe Grandja
- * @since 5.1
- * @see OAuth2AccessToken
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-1.5">Section 1.5 Refresh Token</a>
- */
-public class OAuth2RefreshToken extends AbstractOAuth2Token {
-
-	/**
-	 * Constructs an {@code OAuth2RefreshToken} using the provided parameters.
-	 *
-	 * @param tokenValue the token value
-	 * @param issuedAt the time at which the token was issued
-	 */
-	public OAuth2RefreshToken(String tokenValue, Instant issuedAt) {
-		super(tokenValue, issuedAt, null);
-	}
-}

+ 0 - 35
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2TokenValidator.java

@@ -1,35 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core;
-
-/**
- * Implementations of this interface are responsible for &quot;verifying&quot;
- * the validity and/or constraints of the attributes contained in an OAuth 2.0 Token.
- *
- * @author Joe Grandja
- * @author Josh Cummings
- * @since 5.1
- */
-public interface OAuth2TokenValidator<T extends AbstractOAuth2Token> {
-
-	/**
-	 * Verify the validity and/or constraints of the provided OAuth 2.0 Token.
-	 *
-	 * @param token an OAuth 2.0 token
-	 * @return OAuth2TokenValidationResult the success or failure detail of the validation
-	 */
-	OAuth2TokenValidatorResult validate(T token);
-}

+ 0 - 92
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/OAuth2TokenValidatorResult.java

@@ -1,92 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.oauth2.core;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.springframework.util.Assert;
-
-/**
- * A result emitted from an {@link OAuth2TokenValidator} validation attempt
- *
- * @author Josh Cummings
- * @since 5.1
- */
-public final class OAuth2TokenValidatorResult {
-	static final OAuth2TokenValidatorResult NO_ERRORS = new OAuth2TokenValidatorResult(Collections.emptyList());
-
-	private final Collection<OAuth2Error> errors;
-
-	private OAuth2TokenValidatorResult(Collection<OAuth2Error> errors) {
-		Assert.notNull(errors, "errors cannot be null");
-		this.errors = new ArrayList<>(errors);
-	}
-
-	/**
-	 * Say whether this result indicates success
-	 *
-	 * @return whether this result has errors
-	 */
-	public boolean hasErrors() {
-		return !this.errors.isEmpty();
-	}
-
-	/**
-	 * Return error details regarding the validation attempt
-	 *
-	 * @return the collection of results in this result, if any; returns an empty list otherwise
-	 */
-	public Collection<OAuth2Error> getErrors() {
-		return this.errors;
-	}
-
-	/**
-	 * Construct a successful {@link OAuth2TokenValidatorResult}
-	 *
-	 * @return an {@link OAuth2TokenValidatorResult} with no errors
-	 */
-	public static OAuth2TokenValidatorResult success() {
-		return NO_ERRORS;
-	}
-
-	/**
-	 * Construct a failure {@link OAuth2TokenValidatorResult} with the provided detail
-	 *
-	 * @param errors the list of errors
-	 * @return an {@link OAuth2TokenValidatorResult} with the errors specified
-	 */
-	public static OAuth2TokenValidatorResult failure(OAuth2Error... errors) {
-		return failure(Arrays.asList(errors));
-	}
-
-	/**
-	 * Construct a failure {@link OAuth2TokenValidatorResult} with the provided detail
-	 *
-	 * @param errors the list of errors
-	 * @return an {@link OAuth2TokenValidatorResult} with the errors specified
-	 */
-	public static OAuth2TokenValidatorResult failure(Collection<OAuth2Error> errors) {
-		if (errors.isEmpty()) {
-			return NO_ERRORS;
-		}
-
-		return new OAuth2TokenValidatorResult(errors);
-	}
-}

+ 0 - 222
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AccessTokenResponse.java

@@ -1,222 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core.endpoint;
-
-import org.springframework.lang.Nullable;
-import org.springframework.security.oauth2.core.OAuth2AccessToken;
-import org.springframework.security.oauth2.core.OAuth2RefreshToken;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-
-import java.time.Instant;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A representation of an OAuth 2.0 Access Token Response.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see OAuth2AccessToken
- * @see OAuth2RefreshToken
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-5.1">Section 5.1 Access Token Response</a>
- */
-public final class OAuth2AccessTokenResponse {
-	private OAuth2AccessToken accessToken;
-	private OAuth2RefreshToken refreshToken;
-	private Map<String, Object> additionalParameters;
-
-	private OAuth2AccessTokenResponse() {
-	}
-
-	/**
-	 * Returns the {@link OAuth2AccessToken Access Token}.
-	 *
-	 * @return the {@link OAuth2AccessToken}
-	 */
-	public OAuth2AccessToken getAccessToken() {
-		return this.accessToken;
-	}
-
-	/**
-	 * Returns the {@link OAuth2RefreshToken Refresh Token}.
-	 *
-	 * @since 5.1
-	 * @return the {@link OAuth2RefreshToken}
-	 */
-	public @Nullable OAuth2RefreshToken getRefreshToken() {
-		return this.refreshToken;
-	}
-
-	/**
-	 * Returns the additional parameters returned in the response.
-	 *
-	 * @return a {@code Map} of the additional parameters returned in the response, may be empty.
-	 */
-	public Map<String, Object> getAdditionalParameters() {
-		return this.additionalParameters;
-	}
-
-	/**
-	 * Returns a new {@link Builder}, initialized with the provided access token value.
-	 *
-	 * @param tokenValue the value of the access token
-	 * @return the {@link Builder}
-	 */
-	public static Builder withToken(String tokenValue) {
-		return new Builder(tokenValue);
-	}
-
-	/**
-	 * Returns a new {@link Builder}, initialized with the provided response
-	 * @param response the response to intialize the builder with
-	 * @return the {@link Builder}
-	 */
-	public static Builder withResponse(OAuth2AccessTokenResponse response) {
-		return new Builder(response);
-	}
-
-	/**
-	 * A builder for {@link OAuth2AccessTokenResponse}.
-	 */
-	public static class Builder {
-		private String tokenValue;
-		private OAuth2AccessToken.TokenType tokenType;
-		private long expiresIn;
-		private Set<String> scopes;
-		private String refreshToken;
-		private Map<String, Object> additionalParameters;
-
-		private Instant issuedAt;
-		private Instant expiresAt;
-
-		private Builder(OAuth2AccessTokenResponse response) {
-			OAuth2AccessToken accessToken = response.getAccessToken();
-			this.tokenValue = accessToken.getTokenValue();
-			this.tokenType = accessToken.getTokenType();
-			this.expiresAt = accessToken.getExpiresAt();
-			this.issuedAt = accessToken.getIssuedAt();
-			this.scopes = accessToken.getScopes();
-			this.refreshToken = response.getRefreshToken() == null ?
-					null : response.getRefreshToken().getTokenValue();
-			this.additionalParameters = response.getAdditionalParameters();
-		}
-
-		private Builder(String tokenValue) {
-			this.tokenValue = tokenValue;
-		}
-
-		/**
-		 * Sets the {@link OAuth2AccessToken.TokenType token type}.
-		 *
-		 * @param tokenType the type of token issued
-		 * @return the {@link Builder}
-		 */
-		public Builder tokenType(OAuth2AccessToken.TokenType tokenType) {
-			this.tokenType = tokenType;
-			return this;
-		}
-
-		/**
-		 * Sets the lifetime (in seconds) of the access token.
-		 *
-		 * @param expiresIn the lifetime of the access token, in seconds.
-		 * @return the {@link Builder}
-		 */
-		public Builder expiresIn(long expiresIn) {
-			this.expiresIn = expiresIn;
-			return this;
-		}
-
-		/**
-		 * Sets the scope(s) associated to the access token.
-		 *
-		 * @param scopes the scope(s) associated to the access token.
-		 * @return the {@link Builder}
-		 */
-		public Builder scopes(Set<String> scopes) {
-			this.scopes = scopes;
-			return this;
-		}
-
-		/**
-		 * Sets the refresh token associated to the access token.
-		 *
-		 * @param refreshToken the refresh token associated to the access token.
-		 * @return the {@link Builder}
-		 */
-		public Builder refreshToken(String refreshToken) {
-			this.refreshToken = refreshToken;
-			return this;
-		}
-
-		/**
-		 * Sets the additional parameters returned in the response.
-		 *
-		 * @param additionalParameters the additional parameters returned in the response
-		 * @return the {@link Builder}
-		 */
-		public Builder additionalParameters(Map<String, Object> additionalParameters) {
-			this.additionalParameters = additionalParameters;
-			return this;
-		}
-
-		/**
-		 * Builds a new {@link OAuth2AccessTokenResponse}.
-		 *
-		 * @return a {@link OAuth2AccessTokenResponse}
-		 */
-		public OAuth2AccessTokenResponse build() {
-			Instant issuedAt = getIssuedAt();
-
-			Instant expiresAt = getExpiresAt();
-
-			OAuth2AccessTokenResponse accessTokenResponse = new OAuth2AccessTokenResponse();
-			accessTokenResponse.accessToken = new OAuth2AccessToken(
-				this.tokenType, this.tokenValue, issuedAt, expiresAt, this.scopes);
-			if (StringUtils.hasText(this.refreshToken)) {
-				accessTokenResponse.refreshToken = new OAuth2RefreshToken(this.refreshToken, issuedAt);
-			}
-			accessTokenResponse.additionalParameters = Collections.unmodifiableMap(
-				CollectionUtils.isEmpty(this.additionalParameters) ? Collections.emptyMap() : this.additionalParameters);
-			return accessTokenResponse;
-		}
-
-		private Instant getIssuedAt() {
-			if (this.issuedAt == null) {
-				this.issuedAt = Instant.now();
-			}
-			return this.issuedAt;
-		}
-
-		/**
-		 * expires_in is RECOMMENDED, as per spec https://tools.ietf.org/html/rfc6749#section-5.1
-		 * Therefore, expires_in may not be returned in the Access Token response which would result in the default value of 0.
-		 * For these instances, default the expiresAt to +1 second from issuedAt time.
-		 * @return
-		 */
-		private Instant getExpiresAt() {
-			if (this.expiresAt == null) {
-				Instant issuedAt = getIssuedAt();
-				this.expiresAt = this.expiresIn > 0 ?
-								issuedAt.plusSeconds(this.expiresIn) :
-								issuedAt.plusSeconds(1);
-			}
-			return this.expiresAt;
-		}
-	}
-}

+ 0 - 65
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationExchange.java

@@ -1,65 +0,0 @@
-/*
- * Copyright 2002-2017 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core.endpoint;
-
-import org.springframework.util.Assert;
-
-/**
- * An &quot;exchange&quot; of an OAuth 2.0 Authorization Request and Response
- * for the authorization code grant type.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see OAuth2AuthorizationRequest
- * @see OAuth2AuthorizationResponse
- */
-public final class OAuth2AuthorizationExchange {
-	private final OAuth2AuthorizationRequest authorizationRequest;
-	private final OAuth2AuthorizationResponse authorizationResponse;
-
-	/**
-	 * Constructs a new {@code OAuth2AuthorizationExchange} with the provided
-	 * Authorization Request and Authorization Response.
-	 *
-	 * @param authorizationRequest the {@link OAuth2AuthorizationRequest Authorization Request}
-	 * @param authorizationResponse the {@link OAuth2AuthorizationResponse Authorization Response}
-	 */
-	public OAuth2AuthorizationExchange(OAuth2AuthorizationRequest authorizationRequest,
-										OAuth2AuthorizationResponse authorizationResponse) {
-		Assert.notNull(authorizationRequest, "authorizationRequest cannot be null");
-		Assert.notNull(authorizationResponse, "authorizationResponse cannot be null");
-		this.authorizationRequest = authorizationRequest;
-		this.authorizationResponse = authorizationResponse;
-	}
-
-	/**
-	 * Returns the {@link OAuth2AuthorizationRequest Authorization Request}.
-	 *
-	 * @return the {@link OAuth2AuthorizationRequest}
-	 */
-	public OAuth2AuthorizationRequest getAuthorizationRequest() {
-		return this.authorizationRequest;
-	}
-
-	/**
-	 * Returns the {@link OAuth2AuthorizationResponse Authorization Response}.
-	 *
-	 * @return the {@link OAuth2AuthorizationResponse}
-	 */
-	public OAuth2AuthorizationResponse getAuthorizationResponse() {
-		return this.authorizationResponse;
-	}
-}

+ 0 - 405
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequest.java

@@ -1,405 +0,0 @@
-/*
- * Copyright 2002-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core.endpoint;
-
-import org.springframework.security.core.SpringSecurityCoreVersion;
-import org.springframework.security.oauth2.core.AuthorizationGrantType;
-import org.springframework.util.Assert;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.util.StringUtils;
-import org.springframework.web.util.UriComponentsBuilder;
-
-import java.io.Serializable;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * A representation of an OAuth 2.0 Authorization Request
- * for the authorization code grant type or implicit grant type.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see AuthorizationGrantType
- * @see OAuth2AuthorizationResponseType
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-4.1.1">Section 4.1.1 Authorization Code Grant Request</a>
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-4.2.1">Section 4.2.1 Implicit Grant Request</a>
- */
-public final class OAuth2AuthorizationRequest implements Serializable {
-	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-	private String authorizationUri;
-	private AuthorizationGrantType authorizationGrantType;
-	private OAuth2AuthorizationResponseType responseType;
-	private String clientId;
-	private String redirectUri;
-	private Set<String> scopes;
-	private String state;
-	private Map<String, Object> additionalParameters;
-	private String authorizationRequestUri;
-	private Map<String, Object> attributes;
-
-	private OAuth2AuthorizationRequest() {
-	}
-
-	/**
-	 * Returns the uri for the authorization endpoint.
-	 *
-	 * @return the uri for the authorization endpoint
-	 */
-	public String getAuthorizationUri() {
-		return this.authorizationUri;
-	}
-
-	/**
-	 * Returns the {@link AuthorizationGrantType grant type}.
-	 *
-	 * @return the {@link AuthorizationGrantType}
-	 */
-	public AuthorizationGrantType getGrantType() {
-		return this.authorizationGrantType;
-	}
-
-	/**
-	 * Returns the {@link OAuth2AuthorizationResponseType response type}.
-	 *
-	 * @return the {@link OAuth2AuthorizationResponseType}
-	 */
-	public OAuth2AuthorizationResponseType getResponseType() {
-		return this.responseType;
-	}
-
-	/**
-	 * Returns the client identifier.
-	 *
-	 * @return the client identifier
-	 */
-	public String getClientId() {
-		return this.clientId;
-	}
-
-	/**
-	 * Returns the uri for the redirection endpoint.
-	 *
-	 * @return the uri for the redirection endpoint
-	 */
-	public String getRedirectUri() {
-		return this.redirectUri;
-	}
-
-	/**
-	 * Returns the scope(s).
-	 *
-	 * @return the scope(s)
-	 */
-	public Set<String> getScopes() {
-		return this.scopes;
-	}
-
-	/**
-	 * Returns the state.
-	 *
-	 * @return the state
-	 */
-	public String getState() {
-		return this.state;
-	}
-
-	/**
-	 * Returns the additional parameters used in the request.
-	 *
-	 * @return a {@code Map} of the additional parameters used in the request
-	 */
-	public Map<String, Object> getAdditionalParameters() {
-		return this.additionalParameters;
-	}
-
-	/**
-	 * Returns the attributes associated to the request.
-	 *
-	 * @since 5.2
-	 * @return a {@code Map} of the attributes associated to the request
-	 */
-	public Map<String, Object> getAttributes() {
-		return this.attributes;
-	}
-
-	/**
-	 * Returns the value of an attribute associated to the request, or {@code null} if not available.
-	 *
-	 * @since 5.2
-	 * @param name the name of the attribute
-	 * @param <T> the type of the attribute
-	 * @return the value of the attribute associated to the request
-	 */
-	@SuppressWarnings("unchecked")
-	public <T> T getAttribute(String name) {
-		return (T) this.getAttributes().get(name);
-	}
-
-	/**
-	 * Returns the {@code URI} string representation of the OAuth 2.0 Authorization Request.
-	 *
-	 * <p>
-	 * <b>NOTE:</b> The {@code URI} string is encoded in the
-	 * {@code application/x-www-form-urlencoded} MIME format.
-	 *
-	 * @since 5.1
-	 * @return the {@code URI} string representation of the OAuth 2.0 Authorization Request
-	 */
-	public String getAuthorizationRequestUri() {
-		return this.authorizationRequestUri;
-	}
-
-	/**
-	 * Returns a new {@link Builder}, initialized with the authorization code grant type.
-	 *
-	 * @return the {@link Builder}
-	 */
-	public static Builder authorizationCode() {
-		return new Builder(AuthorizationGrantType.AUTHORIZATION_CODE);
-	}
-
-	/**
-	 * Returns a new {@link Builder}, initialized with the implicit grant type.
-	 *
-	 * @return the {@link Builder}
-	 */
-	public static Builder implicit() {
-		return new Builder(AuthorizationGrantType.IMPLICIT);
-	}
-
-	/**
-	 * Returns a new {@link Builder}, initialized with the values
-	 * from the provided {@code authorizationRequest}.
-	 *
-	 * @since 5.1
-	 * @param authorizationRequest the authorization request used for initializing the {@link Builder}
-	 * @return the {@link Builder}
-	 */
-	public static Builder from(OAuth2AuthorizationRequest authorizationRequest) {
-		Assert.notNull(authorizationRequest, "authorizationRequest cannot be null");
-
-		return new Builder(authorizationRequest.getGrantType())
-				.authorizationUri(authorizationRequest.getAuthorizationUri())
-				.clientId(authorizationRequest.getClientId())
-				.redirectUri(authorizationRequest.getRedirectUri())
-				.scopes(authorizationRequest.getScopes())
-				.state(authorizationRequest.getState())
-				.additionalParameters(authorizationRequest.getAdditionalParameters())
-				.attributes(authorizationRequest.getAttributes());
-	}
-
-	/**
-	 * A builder for {@link OAuth2AuthorizationRequest}.
-	 */
-	public static class Builder {
-		private String authorizationUri;
-		private AuthorizationGrantType authorizationGrantType;
-		private OAuth2AuthorizationResponseType responseType;
-		private String clientId;
-		private String redirectUri;
-		private Set<String> scopes;
-		private String state;
-		private Map<String, Object> additionalParameters;
-		private String authorizationRequestUri;
-		private Map<String, Object> attributes;
-
-		private Builder(AuthorizationGrantType authorizationGrantType) {
-			Assert.notNull(authorizationGrantType, "authorizationGrantType cannot be null");
-			this.authorizationGrantType = authorizationGrantType;
-			if (AuthorizationGrantType.AUTHORIZATION_CODE.equals(authorizationGrantType)) {
-				this.responseType = OAuth2AuthorizationResponseType.CODE;
-			} else if (AuthorizationGrantType.IMPLICIT.equals(authorizationGrantType)) {
-				this.responseType = OAuth2AuthorizationResponseType.TOKEN;
-			}
-		}
-
-		/**
-		 * Sets the uri for the authorization endpoint.
-		 *
-		 * @param authorizationUri the uri for the authorization endpoint
-		 * @return the {@link Builder}
-		 */
-		public Builder authorizationUri(String authorizationUri) {
-			this.authorizationUri = authorizationUri;
-			return this;
-		}
-
-		/**
-		 * Sets the client identifier.
-		 *
-		 * @param clientId the client identifier
-		 * @return the {@link Builder}
-		 */
-		public Builder clientId(String clientId) {
-			this.clientId = clientId;
-			return this;
-		}
-
-		/**
-		 * Sets the uri for the redirection endpoint.
-		 *
-		 * @param redirectUri the uri for the redirection endpoint
-		 * @return the {@link Builder}
-		 */
-		public Builder redirectUri(String redirectUri) {
-			this.redirectUri = redirectUri;
-			return this;
-		}
-
-		/**
-		 * Sets the scope(s).
-		 *
-		 * @param scope the scope(s)
-		 * @return the {@link Builder}
-		 */
-		public Builder scope(String... scope) {
-			if (scope != null && scope.length > 0) {
-				return this.scopes(Arrays.stream(scope).collect(
-					Collectors.toCollection(LinkedHashSet::new)));
-			}
-			return this;
-		}
-
-		/**
-		 * Sets the scope(s).
-		 *
-		 * @param scopes the scope(s)
-		 * @return the {@link Builder}
-		 */
-		public Builder scopes(Set<String> scopes) {
-			this.scopes = scopes;
-			return this;
-		}
-
-		/**
-		 * Sets the state.
-		 *
-		 * @param state the state
-		 * @return the {@link Builder}
-		 */
-		public Builder state(String state) {
-			this.state = state;
-			return this;
-		}
-
-		/**
-		 * Sets the additional parameters used in the request.
-		 *
-		 * @param additionalParameters the additional parameters used in the request
-		 * @return the {@link Builder}
-		 */
-		public Builder additionalParameters(Map<String, Object> additionalParameters) {
-			this.additionalParameters = additionalParameters;
-			return this;
-		}
-
-		/**
-		 * Sets the attributes associated to the request.
-		 *
-		 * @since 5.2
-		 * @param attributes the attributes associated to the request
-		 * @return the {@link Builder}
-		 */
-		public Builder attributes(Map<String, Object> attributes) {
-			this.attributes = attributes;
-			return this;
-		}
-
-		/**
-		 * Sets the {@code URI} string representation of the OAuth 2.0 Authorization Request.
-		 *
-		 * <p>
-		 * <b>NOTE:</b> The {@code URI} string is <b>required</b> to be encoded in the
-		 * {@code application/x-www-form-urlencoded} MIME format.
-		 *
-		 * @since 5.1
-		 * @param authorizationRequestUri the {@code URI} string representation of the OAuth 2.0 Authorization Request
-		 * @return the {@link Builder}
-		 */
-		public Builder authorizationRequestUri(String authorizationRequestUri) {
-			this.authorizationRequestUri = authorizationRequestUri;
-			return this;
-		}
-
-		/**
-		 * Builds a new {@link OAuth2AuthorizationRequest}.
-		 *
-		 * @return a {@link OAuth2AuthorizationRequest}
-		 */
-		public OAuth2AuthorizationRequest build() {
-			Assert.hasText(this.authorizationUri, "authorizationUri cannot be empty");
-			Assert.hasText(this.clientId, "clientId cannot be empty");
-			if (AuthorizationGrantType.IMPLICIT.equals(this.authorizationGrantType)) {
-				Assert.hasText(this.redirectUri, "redirectUri cannot be empty");
-			}
-
-			OAuth2AuthorizationRequest authorizationRequest = new OAuth2AuthorizationRequest();
-			authorizationRequest.authorizationUri = this.authorizationUri;
-			authorizationRequest.authorizationGrantType = this.authorizationGrantType;
-			authorizationRequest.responseType = this.responseType;
-			authorizationRequest.clientId = this.clientId;
-			authorizationRequest.redirectUri = this.redirectUri;
-			authorizationRequest.state = this.state;
-			authorizationRequest.scopes = Collections.unmodifiableSet(
-				CollectionUtils.isEmpty(this.scopes) ?
-					Collections.emptySet() : new LinkedHashSet<>(this.scopes));
-			authorizationRequest.additionalParameters = Collections.unmodifiableMap(
-				CollectionUtils.isEmpty(this.additionalParameters) ?
-					Collections.emptyMap() : new LinkedHashMap<>(this.additionalParameters));
-			authorizationRequest.authorizationRequestUri =
-					StringUtils.hasText(this.authorizationRequestUri) ?
-						this.authorizationRequestUri : this.buildAuthorizationRequestUri();
-			authorizationRequest.attributes = Collections.unmodifiableMap(
-					CollectionUtils.isEmpty(this.attributes) ?
-							Collections.emptyMap() : new LinkedHashMap<>(this.attributes));
-
-			return authorizationRequest;
-		}
-
-		private String buildAuthorizationRequestUri() {
-			MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
-			parameters.set(OAuth2ParameterNames.RESPONSE_TYPE, this.responseType.getValue());
-			parameters.set(OAuth2ParameterNames.CLIENT_ID, this.clientId);
-			if (!CollectionUtils.isEmpty(this.scopes)) {
-				parameters.set(OAuth2ParameterNames.SCOPE,
-						StringUtils.collectionToDelimitedString(this.scopes, " "));
-			}
-			if (this.state != null) {
-				parameters.set(OAuth2ParameterNames.STATE, this.state);
-			}
-			if (this.redirectUri != null) {
-				parameters.set(OAuth2ParameterNames.REDIRECT_URI, this.redirectUri);
-			}
-			if (!CollectionUtils.isEmpty(this.additionalParameters)) {
-				this.additionalParameters.forEach((k, v) -> parameters.set(k, v.toString()));
-			}
-
-			return UriComponentsBuilder.fromHttpUrl(this.authorizationUri)
-					.queryParams(parameters)
-					.encode(StandardCharsets.UTF_8)
-					.build()
-					.toUriString();
-		}
-	}
-}

+ 0 - 218
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponse.java

@@ -1,218 +0,0 @@
-/*
- * Copyright 2002-2017 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core.endpoint;
-
-import org.springframework.security.oauth2.core.OAuth2Error;
-import org.springframework.util.Assert;
-import org.springframework.util.StringUtils;
-
-/**
- * A representation of an OAuth 2.0 Authorization Response for the authorization code grant type.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see OAuth2Error
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-4.1.2">Section 4.1.2 Authorization Response</a>
- */
-public final class OAuth2AuthorizationResponse {
-	private String redirectUri;
-	private String state;
-	private String code;
-	private OAuth2Error error;
-
-	private OAuth2AuthorizationResponse() {
-	}
-
-	/**
-	 * Returns the uri where the response was redirected to.
-	 *
-	 * @return the uri where the response was redirected to
-	 */
-	public String getRedirectUri() {
-		return this.redirectUri;
-	}
-
-	/**
-	 * Returns the state.
-	 *
-	 * @return the state
-	 */
-	public String getState() {
-		return this.state;
-	}
-
-	/**
-	 * Returns the authorization code.
-	 *
-	 * @return the authorization code
-	 */
-	public String getCode() {
-		return this.code;
-	}
-
-	/**
-	 * Returns the {@link OAuth2Error OAuth 2.0 Error} if the Authorization Request failed, otherwise {@code null}.
-	 *
-	 * @return the {@link OAuth2Error} if the Authorization Request failed, otherwise {@code null}
-	 */
-	public OAuth2Error getError() {
-		return this.error;
-	}
-
-	/**
-	 * Returns {@code true} if the Authorization Request succeeded, otherwise {@code false}.
-	 *
-	 * @return {@code true} if the Authorization Request succeeded, otherwise {@code false}
-	 */
-	public boolean statusOk() {
-		return !this.statusError();
-	}
-
-	/**
-	 * Returns {@code true} if the Authorization Request failed, otherwise {@code false}.
-	 *
-	 * @return {@code true} if the Authorization Request failed, otherwise {@code false}
-	 */
-	public boolean statusError() {
-		return (this.error != null && this.error.getErrorCode() != null);
-	}
-
-	/**
-	 * Returns a new {@link Builder}, initialized with the authorization code.
-	 *
-	 * @param code the authorization code
-	 * @return the {@link Builder}
-	 */
-	public static Builder success(String code) {
-		Assert.hasText(code, "code cannot be empty");
-		return new Builder().code(code);
-	}
-
-	/**
-	 * Returns a new {@link Builder}, initialized with the error code.
-	 *
-	 * @param errorCode the error code
-	 * @return the {@link Builder}
-	 */
-	public static Builder error(String errorCode) {
-		Assert.hasText(errorCode, "errorCode cannot be empty");
-		return new Builder().errorCode(errorCode);
-	}
-
-	/**
-	 * A builder for {@link OAuth2AuthorizationResponse}.
-	 */
-	public static class Builder {
-		private String redirectUri;
-		private String state;
-		private String code;
-		private String errorCode;
-		private String errorDescription;
-		private String errorUri;
-
-		private Builder() {
-		}
-
-		/**
-		 * Sets the uri where the response was redirected to.
-		 *
-		 * @param redirectUri the uri where the response was redirected to
-		 * @return the {@link Builder}
-		 */
-		public Builder redirectUri(String redirectUri) {
-			this.redirectUri = redirectUri;
-			return this;
-		}
-
-		/**
-		 * Sets the state.
-		 *
-		 * @param state the state
-		 * @return the {@link Builder}
-		 */
-		public Builder state(String state) {
-			this.state = state;
-			return this;
-		}
-
-		/**
-		 * Sets the authorization code.
-		 *
-		 * @param code the authorization code
-		 * @return the {@link Builder}
-		 */
-		public Builder code(String code) {
-			this.code = code;
-			return this;
-		}
-
-		/**
-		 * Sets the error code.
-		 *
-		 * @param errorCode the error code
-		 * @return the {@link Builder}
-		 */
-		public Builder errorCode(String errorCode) {
-			this.errorCode = errorCode;
-			return this;
-		}
-
-		/**
-		 * Sets the error description.
-		 *
-		 * @param errorDescription the error description
-		 * @return the {@link Builder}
-		 */
-		public Builder errorDescription(String errorDescription) {
-			this.errorDescription = errorDescription;
-			return this;
-		}
-
-		/**
-		 * Sets the error uri.
-		 *
-		 * @param errorUri the error uri
-		 * @return the {@link Builder}
-		 */
-		public Builder errorUri(String errorUri) {
-			this.errorUri = errorUri;
-			return this;
-		}
-
-		/**
-		 * Builds a new {@link OAuth2AuthorizationResponse}.
-		 *
-		 * @return a {@link OAuth2AuthorizationResponse}
-		 */
-		public OAuth2AuthorizationResponse build() {
-			if (StringUtils.hasText(this.code) && StringUtils.hasText(this.errorCode)) {
-				throw new IllegalArgumentException("code and errorCode cannot both be set");
-			}
-			Assert.hasText(this.redirectUri, "redirectUri cannot be empty");
-
-			OAuth2AuthorizationResponse authorizationResponse = new OAuth2AuthorizationResponse();
-			authorizationResponse.redirectUri = this.redirectUri;
-			authorizationResponse.state = this.state;
-			if (StringUtils.hasText(this.code)) {
-				authorizationResponse.code = this.code;
-			} else {
-				authorizationResponse.error = new OAuth2Error(
-					this.errorCode, this.errorDescription, this.errorUri);
-			}
-			return authorizationResponse;
-		}
-	}
-}

+ 0 - 72
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseType.java

@@ -1,72 +0,0 @@
-/*
- * Copyright 2002-2017 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core.endpoint;
-
-import org.springframework.security.core.SpringSecurityCoreVersion;
-import org.springframework.util.Assert;
-
-import java.io.Serializable;
-
-/**
- * The {@code response_type} parameter is consumed by the authorization endpoint which
- * is used by the authorization code grant type and implicit grant type.
- * The client sets the {@code response_type} parameter with the desired grant type before initiating the authorization request.
- *
- * <p>
- * The {@code response_type} parameter value may be one of &quot;code&quot; for requesting an authorization code or
- * &quot;token&quot; for requesting an access token (implicit grant).
-
- * @author Joe Grandja
- * @since 5.0
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-3.1.1">Section 3.1.1 Response Type</a>
- */
-public final class OAuth2AuthorizationResponseType implements Serializable {
-	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-	public static final OAuth2AuthorizationResponseType CODE = new OAuth2AuthorizationResponseType("code");
-	public static final OAuth2AuthorizationResponseType TOKEN = new OAuth2AuthorizationResponseType("token");
-	private final String value;
-
-	private OAuth2AuthorizationResponseType(String value) {
-		Assert.hasText(value, "value cannot be empty");
-		this.value = value;
-	}
-
-	/**
-	 * Returns the value of the authorization response type.
-	 *
-	 * @return the value of the authorization response type
-	 */
-	public String getValue() {
-		return this.value;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj) {
-			return true;
-		}
-		if (obj == null || this.getClass() != obj.getClass()) {
-			return false;
-		}
-		OAuth2AuthorizationResponseType that = (OAuth2AuthorizationResponseType) obj;
-		return this.getValue().equals(that.getValue());
-	}
-
-	@Override
-	public int hashCode() {
-		return this.getValue().hashCode();
-	}
-}

+ 0 - 108
maxkey-protocols/maxkey-protocol-oauth-2.0/src.bak/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2ParameterNames.java

@@ -1,108 +0,0 @@
-/*
- * Copyright 2002-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.oauth2.core.endpoint;
-
-/**
- * Standard and custom (non-standard) parameter names defined in the OAuth Parameters Registry
- * and used by the authorization endpoint and token endpoint.
- *
- * @author Joe Grandja
- * @since 5.0
- * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-11.2">11.2 OAuth Parameters Registry</a>
- */
-public interface OAuth2ParameterNames {
-
-	/**
-	 * {@code grant_type} - used in Access Token Request.
-	 */
-	String GRANT_TYPE = "grant_type";
-
-	/**
-	 * {@code response_type} - used in Authorization Request.
-	 */
-	String RESPONSE_TYPE = "response_type";
-
-	/**
-	 * {@code client_id} - used in Authorization Request and Access Token Request.
-	 */
-	String CLIENT_ID = "client_id";
-
-	/**
-	 * {@code client_secret} - used in Access Token Request.
-	 */
-	String CLIENT_SECRET = "client_secret";
-
-	/**
-	 * {@code redirect_uri} - used in Authorization Request and Access Token Request.
-	 */
-	String REDIRECT_URI = "redirect_uri";
-
-	/**
-	 * {@code scope} - used in Authorization Request, Authorization Response, Access Token Request and Access Token Response.
-	 */
-	String SCOPE = "scope";
-
-	/**
-	 * {@code state} - used in Authorization Request and Authorization Response.
-	 */
-	String STATE = "state";
-
-	/**
-	 * {@code code} - used in Authorization Response and Access Token Request.
-	 */
-	String CODE = "code";
-
-	/**
-	 * {@code access_token} - used in Authorization Response and Access Token Response.
-	 */
-	String ACCESS_TOKEN = "access_token";
-
-	/**
-	 * {@code token_type} - used in Authorization Response and Access Token Response.
-	 */
-	String TOKEN_TYPE = "token_type";
-
-	/**
-	 * {@code expires_in} - used in Authorization Response and Access Token Response.
-	 */
-	String EXPIRES_IN = "expires_in";
-
-	/**
-	 * {@code refresh_token} - used in Access Token Request and Access Token Response.
-	 */
-	String REFRESH_TOKEN = "refresh_token";
-
-	/**
-	 * {@code error} - used in Authorization Response and Access Token Response.
-	 */
-	String ERROR = "error";
-
-	/**
-	 * {@code error_description} - used in Authorization Response and Access Token Response.
-	 */
-	String ERROR_DESCRIPTION = "error_description";
-
-	/**
-	 * {@code error_uri} - used in Authorization Response and Access Token Response.
-	 */
-	String ERROR_URI = "error_uri";
-
-	/**
-	 * Non-standard parameter (used internally).
-	 */
-	String REGISTRATION_ID = "registration_id";
-
-}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است