cas5.2.6(1)构建服务端

环境:jdk1.8,tomcat8

1、下载项目

官方的地址https://github.com/apereo/cas-overlay-template

我这边是直接用git命令下载的(5.2版本)

D:\git>e:

E:\>cd lb

E:\lb>git clone -b 5.2 https://github.com/apereo/cas-overlay-template.git
Cloning into 'cas-overlay-template'...
remote: Enumerating objects: 38, done.R
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 1145 (delta 12), reused 23 (delta 9), pack-reused 1107R
Receiving objects: 100% (1145/1145), 10.38 MiB | 463.00 KiB/s, done.
Resolving deltas: 100% (585/585), done.

E:\lb>

2、导入到idea,项目结构如下

cas5.2.6(1)构建服务端_第1张图片

3、去pom文件里删除没用的东西

我这边下载不到0.0.4版本的

cas5.2.6(1)构建服务端_第2张图片

就直接用了0.0.5版本的

 

将依赖挪到profiles外面(圈出来的)

cas5.2.6(1)构建服务端_第3张图片

profiles标签里的可以都删了

可能下载不到这个依赖war  cas-server-webapp-tomcat-5.2.6.war

#官方下载地址 https://oss.sonatype.org/content/repositories/releases/org/apereo/cas/

pom.xml



    4.0.0
    org.apereo.cas
    cas-overlay
    war
    1.0

    
        
            
                com.rimerosolutions.maven.plugins
                wrapper-maven-plugin
                0.0.5
                
                    true
                    MD5
                
            
            
                org.springframework.boot
                spring-boot-maven-plugin
                ${springboot.version}
                
                    ${mainClassName}
                    true
                    ${isExecutable}
                    WAR
                
                
                    
                        
                            repackage
                        
                    
                
            
            
                org.apache.maven.plugins
                maven-war-plugin
                2.6
                
                    cas
                    false
                    false
                    
                        false
                        ${manifestFileToUse}
                    
                    
                        
                            org.apereo.cas
                            cas-server-webapp${app.server}
                        
                    
                
            
            
                org.apache.maven.plugins
                maven-compiler-plugin
                3.3
            
        
        cas
    

    
        
            org.apereo.cas
            cas-server-webapp${app.server}
            ${cas.version}
            war
            runtime
        
        
    

    
        5.2.6
        1.5.12.RELEASE
        
        -tomcat

        org.springframework.boot.loader.WarLauncher
        false
        ${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp${app.server}/META-INF/MANIFEST.MF

        1.8
        1.8
        UTF-8
    

    
        
            sonatype-releases
            http://oss.sonatype.org/content/repositories/releases/
            
                false
            
            
                true
            
        
        
            sonatype-snapshots
            https://oss.sonatype.org/content/repositories/snapshots/
            
                true
            
            
                false
            
        
        
            shibboleth-releases
            https://build.shibboleth.net/nexus/content/repositories/releases
        
    

4、新建目录文件夹

cas5.2.6(1)构建服务端_第4张图片

最后要配置成这样

cas5.2.6(1)构建服务端_第5张图片

 

5、把tomcat下(overlays/org.apereo.cas.cas-server-webapp-tomcat-5.2.6/WEB-INF/classes/application.properties)的application.properties复制到resource下

如果项目中没有这个文件夹,请点击maven边上的刷新按钮

cas5.2.6(1)构建服务端_第6张图片

关闭ssl,将server.ssl.enabled改成false

application.properties

##
# CAS Server Context Configuration
#
server.context-path=/cas
server.port=8443

server.ssl.enabled=false
#server.ssl.key-store=file:/etc/cas/thekeystore
#server.ssl.key-store-password=changeit
#server.ssl.key-password=changeit
# server.ssl.ciphers=
# server.ssl.client-auth=

# server.ssl.key-alias=
# server.ssl.key-store-provider=
# server.ssl.key-store-type=
# server.ssl.protocol=
# server.ssl.trust-store=
# server.ssl.trust-store-password=
# server.ssl.trust-store-provider=
# server.ssl.trust-store-type=

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.max-threads=10
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
# 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

management.security.enabled=true
management.security.roles=ACTUATOR,ADMIN
management.security.sessions=if_required
management.context-path=/status
management.add-application-context-header=false

security.basic.authorize-mode=role
security.basic.enabled=false
security.basic.path=/cas/status/**

##
# 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
##
# 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 Authentication Credentials
#
cas.authn.accept.users=casuser::Mellon

6、测试

根目录下运行cmd

E:\lb\cas-overlay-template>build.cmd run

出现下图表示运行成功

cas5.2.6(1)构建服务端_第7张图片

cas5.2.6(1)构建服务端_第8张图片

默认帐号密码:

casuser

Mellon

cas5.2.6(1)构建服务端_第9张图片

参考:

https://blog.csdn.net/yelllowcong/article/details/79230681

你可能感兴趣的:(cas)