Explorar o código

崔深圳服务器版本

lidongyang %!s(int64=5) %!d(string=hai) anos
pai
achega
e3bd932caa

+ 15 - 4
src/main/java/com/ldy/custom/MyAuthenticationHandler.java

@@ -8,6 +8,8 @@ import org.apereo.cas.authentication.handler.support.AbstractUsernamePasswordAut
 import org.apereo.cas.authentication.principal.PrincipalFactory;
 import org.apereo.cas.services.ServicesManager;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.datasource.DriverManagerDataSource;
@@ -17,8 +19,13 @@ import java.security.GeneralSecurityException;
 import java.util.ArrayList;
 
 public class MyAuthenticationHandler extends AbstractUsernamePasswordAuthenticationHandler {
+
     private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(MyAuthenticationHandler.class);
 
+    @Autowired
+    private Environment environment;
+
+
     public MyAuthenticationHandler(String name, ServicesManager servicesManager, PrincipalFactory principalFactory,
                  Integer order) {
         super(name, servicesManager, principalFactory, order);
@@ -34,10 +41,14 @@ public class MyAuthenticationHandler extends AbstractUsernamePasswordAuthenticat
                                                                                         String originalPassword) throws GeneralSecurityException, PreventedException {
         // TODO Auto-generated method stub
         DriverManagerDataSource d=new DriverManagerDataSource();
-        d.setDriverClassName("com.mysql.jdbc.Driver");
-        d.setUrl("jdbc:mysql://rm-2zea3p7q7lrvjs8s4.mysql.rds.aliyuncs.com/hsdataplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false");
-        d.setUsername("hsdataplatform");
-        d.setPassword("Lightinit@1");
+//        d.setDriverClassName("com.mysql.jdbc.Driver");
+//        d.setUrl("jdbc:mysql://39.105.217.215:3306/hsdataplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false");
+//        d.setUsername("hsdataplatform");
+//        d.setPassword("Lightinit@1");
+        d.setDriverClassName(environment.getProperty("driverClassName"));
+        d.setUrl(environment.getProperty("url"));
+        d.setUsername(environment.getProperty("username"));
+        d.setPassword(environment.getProperty("password"));
         JdbcTemplate template=new JdbcTemplate();
         template.setDataSource(d);
 

+ 135 - 0
src/main/resources/application.properties

@@ -0,0 +1,135 @@
+# 神马通用
+#driverClassName=com.mysql.jdbc.Driver
+#url=jdbc:mysql://39.105.217.215:3306/hsdataplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false
+#username=hsdataplatform
+#password=Lightinit@1
+
+## 华夏新思路
+#driverClassName=com.mysql.jdbc.Driver
+#url=jdbc:mysql://rm-2zea3p7q7lrvjs8s4.mysql.rds.aliyuncs.com/hsdataplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false
+#username=hsdataplatform
+#password=Lightinit@1
+
+## 服务器
+driverClassName=com.mysql.jdbc.Driver
+url=jdbc:mysql://localhost:3306/hsdataplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false
+username=root
+password=Admin#123
+
+##
+# CAS Server Context Configuration
+#
+server.context-path=/cas
+server.port=8443
+
+server.ssl.key-store=file:/etc/cas/thekeystore
+server.ssl.key-store-password=changeit
+server.ssl.key-password=changeit
+
+server.max-http-header-size=2097152
+server.use-forward-headers=true
+server.connection-timeout=20000
+server.error.include-stacktrace=ALWAYS
+
+server.compression.enabled=true
+server.compression.mime-types=application/javascript,application/json,application/xml,text/html,text/xml,text/plain
+
+server.tomcat.max-http-post-size=2097152
+server.tomcat.basedir=build/tomcat
+server.tomcat.accesslog.enabled=true
+server.tomcat.accesslog.pattern=%t %a "%r" %s (%D ms)
+server.tomcat.accesslog.suffix=.log
+server.tomcat.min-spare-threads=10
+server.tomcat.max-threads=200
+server.tomcat.port-header=X-Forwarded-Port
+server.tomcat.protocol-header=X-Forwarded-Proto
+server.tomcat.protocol-header-https-value=https
+server.tomcat.remote-ip-header=X-FORWARDED-FOR
+server.tomcat.uri-encoding=UTF-8
+
+spring.http.encoding.charset=UTF-8
+spring.http.encoding.enabled=true
+spring.http.encoding.force=true
+
+##
+# CAS Cloud Bus Configuration
+#
+spring.cloud.bus.enabled=false
+
+# Indicates that systemPropertiesOverride can be used.
+# Set to false to prevent users from changing the default accidentally. Default true.
+spring.cloud.config.allow-override=true
+
+# External properties should override system properties.
+spring.cloud.config.override-system-properties=false
+
+# When allowOverride is true, external properties should take lowest priority, and not override any
+# existing property sources (including local config files).
+spring.cloud.config.override-none=false
+
+# spring.cloud.bus.refresh.enabled=true
+# spring.cloud.bus.env.enabled=true
+# spring.cloud.bus.destination=CasCloudBus
+# spring.cloud.bus.ack.enabled=true
+
+endpoints.enabled=false
+endpoints.sensitive=true
+
+endpoints.restart.enabled=false
+endpoints.shutdown.enabled=false
+
+# Control the security of the management/actuator endpoints
+# The 'enabled' flag below here controls the rendering of details for the health endpoint amongst other things.
+management.security.enabled=true
+management.security.roles=ACTUATOR,ADMIN
+management.security.sessions=if_required
+management.context-path=/status
+management.add-application-context-header=false
+
+# Define a CAS-specific "WARN" status code and its order
+management.health.status.order=WARN, DOWN, OUT_OF_SERVICE, UNKNOWN, UP
+
+# Control the security of the management/actuator endpoints
+# With basic authentication, assuming Spring Security and/or relevant modules are on the classpath.
+security.basic.authorize-mode=role
+security.basic.path=/cas/status/**
+# security.basic.enabled=true
+# security.user.name=casuser
+# security.user.password=
+
+##
+# CAS Web Application Session Configuration
+#
+server.session.timeout=300
+server.session.cookie.http-only=true
+server.session.tracking-modes=COOKIE
+
+##
+# CAS Thymeleaf View Configuration
+#
+spring.thymeleaf.encoding=UTF-8
+spring.thymeleaf.cache=true
+spring.thymeleaf.mode=HTML
+spring.thymeleaf.template-resolver-order=100
+##
+# CAS Log4j Configuration
+#
+# logging.config=file:/etc/cas/log4j2.xml
+server.context-parameters.isLog4jAutoInitializationDisabled=true
+
+##
+# CAS AspectJ Configuration
+#
+spring.aop.auto=true
+spring.aop.proxy-target-class=true
+
+#注释掉cas默认用户
+#cas.authn.accept.users=casuser::Mellon
+
+​
+#可http请求
+cas.tgc.secure=false
+cas.serviceRegistry.initFromJson=true
+#退出登陆跳转
+cas.logout.followServiceRedirects=true
+

BIN=BIN
src/main/resources/cas 服务端配置说明.docx