diff --git a/code/jeeplatform-sso/src/main/java/org/muses/jeeplatform/cas/authentication/security/providers/CostomUsernamePasswordAuthentication.java b/code/jeeplatform-sso/src/main/java/org/muses/jeeplatform/cas/authentication/security/providers/CostomUsernamePasswordAuthentication.java new file mode 100644 index 0000000000000000000000000000000000000000..eb92d161dec18695ca4177e2f91f666fe5ef4b18 --- /dev/null +++ b/code/jeeplatform-sso/src/main/java/org/muses/jeeplatform/cas/authentication/security/providers/CostomUsernamePasswordAuthentication.java @@ -0,0 +1,45 @@ +package org.muses.jeeplatform.cas.authentication.security.providers; + +import org.jasig.cas.authentication.HandlerResult; +import org.jasig.cas.authentication.PreventedException; +import org.jasig.cas.authentication.UsernamePasswordCredential; +import org.jasig.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler; + +import javax.security.auth.login.FailedLoginException; +import java.security.GeneralSecurityException; + +/** + *
+ *  CAS单点登录验证
+ * 
+ * + * @author nicky.ma + *
+ * 修改记录
+ *    修改后版本:     修改人:  修改日期: 2019年05月19日  修改内容:
+ * 
+ */ +public class CostomUsernamePasswordAuthentication extends AbstractUsernamePasswordAuthenticationHandler { + + + @Override + protected HandlerResult authenticateUsernamePasswordInternal(UsernamePasswordCredential usernamePasswordCredential) throws GeneralSecurityException, PreventedException { + if (usernamePasswordCredential == null) { + throw new FailedLoginException("No user can be accepted because none is defined"); + } + return doAuthentication(usernamePasswordCredential); + } + + /** + * 用户密码验证 + * @param credential + * @return + */ + private HandlerResult doAuthentication(UsernamePasswordCredential credential) { + String username = credential.getUsername(); + String password = credential.getPassword(); + + String fullUserName = username; + return createHandlerResult(credential , this.principalFactory.createPrincipal(username), null); + } +} diff --git a/code/jeeplatform-sso/src/main/webapp/WEB-INF/deployerConfigContext.xml b/code/jeeplatform-sso/src/main/webapp/WEB-INF/deployerConfigContext.xml index fe73ecf052bd5277fd8260eb98629f7f70a86f02..2ba7dd61700802e9b4613f2c07b10d736c71470c 100644 --- a/code/jeeplatform-sso/src/main/webapp/WEB-INF/deployerConfigContext.xml +++ b/code/jeeplatform-sso/src/main/webapp/WEB-INF/deployerConfigContext.xml @@ -15,10 +15,37 @@ http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/jeeplatform-sso/src/main/webapp/cas.properties b/code/jeeplatform-sso/src/main/webapp/cas.properties index fc00e36776f0b368dcc8eacf759beb0829fc3a79..81b794d2c22a72609872bb98d2bc41de7657f392 100644 --- a/code/jeeplatform-sso/src/main/webapp/cas.properties +++ b/code/jeeplatform-sso/src/main/webapp/cas.properties @@ -1,5 +1,15 @@ server.name=http://localhost:8080 server.prefix=${server.name}/cas + +## +# Datasource config +platform.jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/jeeplatform?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false +platform.jdbc.username=root +platform.jdbc.password=root +platform.jdbc.publickey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKZijIzzXp1dyksL1ZSejBmuVz1Y0vgiQVbcQ/13p4pwHRo8gU3pd6YaWutOlBTEWvHBbnGxIdnrhxnQZGwU1O0CAwEAAQ== +platform.jdbc.initialSize=10 +platform.jdbc.minIdle=10 +platform.jdbc.maxActive=50 # security configuration based on IP address to access the /status and /statistics pages # cas.securityContext.adminpages.ip=127\.0\.0\.1