【问题标题】:CAS Delegated Authentication with ADFS使用 ADFS 的 CAS 委托身份验证
【发布时间】:2018-07-23 09:03:43
【问题描述】:

我正在尝试使用 ADFS 的委托身份验证设置 CAS。我检查了delegation 和添加ADFS integration 的文档。 当我尝试运行 CAS 服务器时,出现以下异常。有人可以帮助我了解发生了什么问题吗?

2018-07-20 18:01:15,247 WARN [com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter] - <Problem stopping reporter>
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'casMetricsConfiguration': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

我正在使用这个 CAS 版本:

   __   ____      _      ____   __  
  / /  / ___|    / \    / ___|  \ \ 
 | |  | |       / _ \   \___ \   | |
 | |  | |___   / ___ \   ___) |  | |
 | |   \____| /_/   \_\ |____/   | |
  \_\                           /_/ 

CAS Version: 5.2.5
CAS Commit Id: 6bbfdac91a20be3ace0d90de3ed837ada5b60438
CAS Build Date/Time: 2018-06-25T11:24:41Z
Spring Boot Version: 1.5.12.RELEASE
------------------------------------------------------------
Java Home: /Users/bart/.sdkman/candidates/java/8u152-zulu/jre
Java Vendor: Azul Systems, Inc.
Java Version: 1.8.0_152
JVM Free Memory: 372 MB
JVM Maximum Memory: 3 GB
JVM Total Memory: 586 MB
JCE Installed: No
------------------------------------------------------------
OS Architecture: x86_64
OS Name: Mac OS X
OS Version: 10.13.6
OS Date/Time: 2018-07-20T18:01:10.183
OS Temp Directory: /var/folders/rw/ps9zf0vn7vn92rfslbzl4nzm0000gn/T/
------------------------------------------------------------
Apache Tomcat Version: Apache Tomcat/8.5.30
------------------------------------------------------------

这是我的 pom.xml。我添加了“cas-server-support-pac4j-webflow”和“cas-server-support-wsfederation-webflow”。由于早期的构建问题,添加了“fasterxml”、“thymeleaf-layout-dialect”和“javax.servlet-api”的依赖项。我不确定这是否正确?

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd ">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-overlay</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>

    <build>
        <plugins>
            <plugin>
                <groupId>com.rimerosolutions.maven.plugins</groupId>
                <artifactId>wrapper-maven-plugin</artifactId>
                <version>0.0.4</version>
                <configuration>
                    <verifyDownload>true</verifyDownload>
                    <checksumAlgorithm>MD5</checksumAlgorithm>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${springboot.version}</version>
                <configuration>
                    <mainClass>${mainClassName}</mainClass>
                    <addResources>true</addResources>
                    <executable>${isExecutable}</executable>
                    <layout>WAR</layout>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <warName>cas</warName>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <recompressZippedFiles>false</recompressZippedFiles>
                    <archive>
                        <compress>false</compress>
                        <manifestFile>${manifestFileToUse}</manifestFile>
                    </archive>
                    <overlays>
                        <overlay>
                            <groupId>org.apereo.cas</groupId>
                            <artifactId>cas-server-webapp${app.server}</artifactId>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
            </plugin>
        </plugins>
        <finalName>cas</finalName>
    </build>

    <properties>
        <cas.version>5.2.5</cas.version>
        <springboot.version>1.5.14.RELEASE</springboot.version>
        <app.server>-tomcat</app.server>

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

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-webapp${app.server}</artifactId>
            <version>${cas.version}</version>
            <type>war</type>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-pac4j-webflow</artifactId>
            <version>${cas.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-wsfederation-webflow</artifactId>
            <version>${cas.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml</groupId>
            <artifactId>classmate</artifactId>
            <version>1.4.0</version>
        </dependency>
        <dependency>
            <groupId>nz.net.ultraq.thymeleaf</groupId>
            <artifactId>thymeleaf-layout-dialect</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>sonatype-releases</id>
            <url>http://oss.sonatype.org/content/repositories/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
        <repository>
            <id>sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
        <repository>
            <id>shibboleth-releases</id>
            <url>https://build.shibboleth.net/nexus/content/repositories/releases</url>
        </repository>
    </repositories>

    <profiles>
        <profile>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <id>default</id>
            <dependencies>
                <dependency>
                    <groupId>org.apereo.cas</groupId>
                    <artifactId>cas-server-webapp${app.server}</artifactId>
                    <version>${cas.version}</version>
                    <type>war</type>
                    <scope>runtime</scope>
                </dependency>
                <!--
                ...Additional dependencies may be placed here...
                -->
            </dependencies>
        </profile>

        <profile>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <id>exec</id>
            <properties>
                <mainClassName>org.apereo.cas.web.CasWebApplication</mainClassName>
                <isExecutable>true</isExecutable>
                <manifestFileToUse></manifestFileToUse>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.soebes.maven.plugins</groupId>
                        <artifactId>echo-maven-plugin</artifactId>
                        <version>0.3.0</version>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>echo</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <echos>
                                <echo>Executable profile to make the generated CAS web application executable.</echo>
                            </echos>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <id>bootiful</id>
            <properties>
                <app.server>-tomcat</app.server>
                <isExecutable>false</isExecutable>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.apereo.cas</groupId>
                    <artifactId>cas-server-webapp${app.server}</artifactId>
                    <version>${cas.version}</version>
                    <type>war</type>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <id>pgp</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.s4u.plugins</groupId>
                        <artifactId>pgpverify-maven-plugin</artifactId>
                        <version>1.1.0</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <pgpKeyServer>hkp://pool.sks-keyservers.net</pgpKeyServer>
                            <pgpKeysCachePath>${settings.localRepository}/pgpkeys-cache</pgpKeysCachePath>
                            <scope>test</scope>
                            <verifyPomFiles>true</verifyPomFiles>
                            <failNoSignature>false</failNoSignature>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

【问题讨论】:

    标签: java spring authentication cas adfs


    【解决方案1】:

    我通过将依赖项移动到默认配置文件解决了这个问题,它说:

    <!--
    ...Additional dependencies may be placed here...
    -->
    

    我将依赖减少到我实际需要的 2 个。

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd ">
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.apereo.cas</groupId>
        <artifactId>cas-overlay</artifactId>
        <packaging>war</packaging>
        <version>1.0</version>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>com.rimerosolutions.maven.plugins</groupId>
                    <artifactId>wrapper-maven-plugin</artifactId>
                    <version>0.0.4</version>
                    <configuration>
                        <verifyDownload>true</verifyDownload>
                        <checksumAlgorithm>MD5</checksumAlgorithm>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${springboot.version}</version>
                    <configuration>
                        <mainClass>${mainClassName}</mainClass>
                        <addResources>true</addResources>
                        <executable>${isExecutable}</executable>
                        <layout>WAR</layout>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <warName>cas</warName>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                        <recompressZippedFiles>false</recompressZippedFiles>
                        <archive>
                            <compress>false</compress>
                            <manifestFile>${manifestFileToUse}</manifestFile>
                        </archive>
                        <overlays>
                            <overlay>
                                <groupId>org.apereo.cas</groupId>
                                <artifactId>cas-server-webapp${app.server}</artifactId>
                            </overlay>
                        </overlays>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                </plugin>
            </plugins>
            <finalName>cas</finalName>
        </build>
    
        <properties>
            <cas.version>5.2.5</cas.version>
            <springboot.version>1.5.14.RELEASE</springboot.version>
            <app.server>-tomcat</app.server>
    
            <mainClassName>org.springframework.boot.loader.WarLauncher</mainClassName>
            <isExecutable>false</isExecutable>
            <manifestFileToUse>${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp${app.server}/META-INF/MANIFEST.MF</manifestFileToUse>
    
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        </properties>
    
        <repositories>
            <repository>
                <id>sonatype-releases</id>
                <url>http://oss.sonatype.org/content/repositories/releases/</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <releases>
                    <enabled>true</enabled>
                </releases>
            </repository>
            <repository>
                <id>sonatype-snapshots</id>
                <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
                <releases>
                    <enabled>false</enabled>
                </releases>
            </repository>
            <repository>
                <id>shibboleth-releases</id>
                <url>https://build.shibboleth.net/nexus/content/repositories/releases</url>
            </repository>
        </repositories>
    
        <profiles>
            <profile>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <id>default</id>
                <dependencies>
                    <dependency>
                        <groupId>org.apereo.cas</groupId>
                        <artifactId>cas-server-webapp${app.server}</artifactId>
                        <version>${cas.version}</version>
                        <type>war</type>
                        <scope>runtime</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.apereo.cas</groupId>
                        <artifactId>cas-server-support-wsfederation-webflow</artifactId>
                        <version>${cas.version}</version>
                    </dependency>
                </dependencies>
            </profile>
    
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>exec</id>
                <properties>
                    <mainClassName>org.apereo.cas.web.CasWebApplication</mainClassName>
                    <isExecutable>true</isExecutable>
                    <manifestFileToUse></manifestFileToUse>
                </properties>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>com.soebes.maven.plugins</groupId>
                            <artifactId>echo-maven-plugin</artifactId>
                            <version>0.3.0</version>
                            <executions>
                                <execution>
                                    <phase>prepare-package</phase>
                                    <goals>
                                        <goal>echo</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <echos>
                                    <echo>Executable profile to make the generated CAS web application executable.</echo>
                                </echos>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            </profile>
    
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>bootiful</id>
                <properties>
                    <app.server>-tomcat</app.server>
                    <isExecutable>false</isExecutable>
                </properties>
                <dependencies>
                    <dependency>
                        <groupId>org.apereo.cas</groupId>
                        <artifactId>cas-server-webapp${app.server}</artifactId>
                        <version>${cas.version}</version>
                        <type>war</type>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
            </profile>
    
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>pgp</id>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>com.github.s4u.plugins</groupId>
                            <artifactId>pgpverify-maven-plugin</artifactId>
                            <version>1.1.0</version>
                            <executions>
                                <execution>
                                    <goals>
                                        <goal>check</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <pgpKeyServer>hkp://pool.sks-keyservers.net</pgpKeyServer>
                                <pgpKeysCachePath>${settings.localRepository}/pgpkeys-cache</pgpKeysCachePath>
                                <scope>test</scope>
                                <verifyPomFiles>true</verifyPomFiles>
                                <failNoSignature>false</failNoSignature>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>
    </project>
    

    现在我的 CAS 服务器运行,我可以配置 ADFS 集成设置。

    【讨论】:

      猜你喜欢
      • 2019-03-10
      • 1970-01-01
      • 1970-01-01
      • 2016-05-11
      • 2023-03-25
      • 2015-04-18
      • 2012-11-08
      • 2022-07-06
      • 1970-01-01
      相关资源
      最近更新 更多