All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ncope.core.syncope-core-spring.2.0.15.source-code.securityContext.xml Maven / Gradle / Ivy

There is a newer version: 3.0.9
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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

  http://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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:security="http://www.springframework.org/schema/security"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/security
                           http://www.springframework.org/schema/security/spring-security.xsd">

  <bean id="adminUser" class="java.lang.String">
    <constructor-arg value="${adminUser}"/>
  </bean>
  <bean id="adminPassword" class="java.lang.String">
    <constructor-arg value="${adminPassword}"/>
  </bean>
  <bean id="adminPasswordAlgorithm" class="java.lang.String">
    <constructor-arg value="${adminPasswordAlgorithm}"/>
  </bean>

  <bean id="anonymousUser" class="java.lang.String">
    <constructor-arg value="${anonymousUser}"/>
  </bean>
  <bean id="anonymousKey" class="java.lang.String">
    <constructor-arg value="${anonymousKey}"/>
  </bean>
  
  <bean id="jwtIssuer" class="java.lang.String">
    <constructor-arg value="${jwtIssuer}"/>
  </bean>
  <bean id="jwsKey" class="java.lang.String">
    <constructor-arg value="${jwsKey}"/>
  </bean>

  <bean id="credentialChecker" class="org.apache.syncope.core.spring.security.DefaultCredentialChecker">
    <constructor-arg value="${jwsKey}" index="0"/>
    <constructor-arg value="${adminPassword}" index="1"/>
    <constructor-arg value="${anonymousKey}" index="2"/>
  </bean>

  <bean id="accessTokenJwsSignatureVerifier"
        class="org.apache.syncope.core.spring.security.jws.AccessTokenJwsSignatureVerifier">
    <property name="jwsAlgorithm" value="${jwsAlgorithm}"/>
    <property name="jwsKey" value="${jwsKey}"/>
  </bean>
  <bean id="accessTokenJwsSignatureProvider"
        class="org.apache.syncope.core.spring.security.jws.AccessTokenJwsSignatureProvider">
    <property name="jwsAlgorithm" value="${jwsAlgorithm}"/>
    <property name="jwsKey" value="${jwsKey}"/>
  </bean>
  
  <bean class="${passwordGenerator}"/>
  <bean class="org.apache.syncope.core.spring.DefaultRolesPrefixPostProcessor"/>
  
  <security:global-method-security pre-post-annotations="enabled"/>
  
  <bean id="securityContextRepository" class='org.springframework.security.web.context.NullSecurityContextRepository'/>
  <bean id="securityContextPersistenceFilter"
        class="org.springframework.security.web.context.SecurityContextPersistenceFilter">
    <constructor-arg ref="securityContextRepository"/>
  </bean>

  <bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy">
    <security:filter-chain-map request-matcher="ant">
      <security:filter-chain pattern="/**" filters="securityContextPersistenceFilter"/>
    </security:filter-chain-map>
  </bean>  

  <bean id="firewall" class="org.springframework.security.web.firewall.DefaultHttpFirewall">
    <property name="allowUrlEncodedSlash" value="true"/>
  </bean>
  <security:http-firewall ref="firewall"/>

  <bean id="authenticationDetailsSource"
        class="org.apache.syncope.core.spring.security.SyncopeAuthenticationDetailsSource"/>
      
  <bean id="basicAuthenticationEntryPoint" 
        class="org.apache.syncope.core.spring.security.SyncopeBasicAuthenticationEntryPoint">
    <property name="realmName" value="Apache Syncope authentication"/>
  </bean>
  
  <bean id="jwtAuthenticationFilter" class="org.apache.syncope.core.spring.security.JWTAuthenticationFilter">
    <property name="authenticationManager" ref="authenticationManager"/>
    <property name="authenticationEntryPoint" ref="basicAuthenticationEntryPoint"/>
    <property name="authenticationDetailsSource" ref="authenticationDetailsSource"/>
  </bean>
  
  <bean id="mustChangePasswordFilter" class="org.apache.syncope.core.spring.security.MustChangePasswordFilter"/>

  <bean id="syncopeAccessDeniedHandler" class="org.apache.syncope.core.spring.security.SyncopeAccessDeniedHandler"/>
    
  <security:http create-session="stateless"
                 security-context-repository-ref="securityContextRepository"
                 entry-point-ref="basicAuthenticationEntryPoint"
                 use-expressions="false" disable-url-rewriting="false"
                 pattern="/**">

    <security:anonymous username="${anonymousUser}"/>

    <security:custom-filter ref="jwtAuthenticationFilter" before="BASIC_AUTH_FILTER"/>
    <security:http-basic authentication-details-source-ref="authenticationDetailsSource"/>
    
    <security:custom-filter before="FILTER_SECURITY_INTERCEPTOR" ref="mustChangePasswordFilter"/>
    
    <security:access-denied-handler ref="syncopeAccessDeniedHandler"/>
    
    <security:headers disabled="true"/>
    <security:csrf disabled="true"/>
  </security:http>

  <bean class="org.apache.syncope.core.spring.security.AuthDataAccessor"/>

  <bean id="usernamePasswordAuthenticationProvider"
        class="org.apache.syncope.core.spring.security.UsernamePasswordAuthenticationProvider"/>

  <bean id="jwtAuthenticationProvider"
        class="org.apache.syncope.core.spring.security.JWTAuthenticationProvider"/>

  <security:authentication-manager alias="authenticationManager">
    <security:authentication-provider ref="usernamePasswordAuthenticationProvider"/>
    <security:authentication-provider ref="jwtAuthenticationProvider"/>
  </security:authentication-manager>
</beans>





© 2015 - 2024 Weber Informatics LLC | Privacy Policy