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

foundation.smallcrew-security.1.0.10.source-code.smallcrew-security.xml Maven / Gradle / Ivy

Go to download

Foundation of all smallcrew's projects needing authenticated users and role management

The newest version!
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">

  <context:component-scan base-package="fr.smallcrew.security"/>

  <bean id="rememberMeAuthenticationProvider" class="org.springframework.security.authentication.RememberMeAuthenticationProvider">
    <constructor-arg value="${security.key}"/>
  </bean>

  <bean id="rememberMeServices" class="org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices">
    <constructor-arg value="${security.key}"/>
    <constructor-arg ref="userService"/>
    <constructor-arg ref="userTokenService"/>
    <property name="parameter" value="rememberMe"/>
  </bean>

  <bean id="customUsernamePasswordAuthenticationFilter" class="fr.smallcrew.security.web.CustomUsernamePasswordAuthenticationFilter">
    <property name="authenticationManager" ref="authenticationManager"/>
    <property name="usernameParameter" value="username"/>
    <property name="passwordParameter" value="password"/>
    <property name="rememberMeServices" ref="rememberMeServices"/>
  </bean>

  <bean id="loginUrlAuthenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
    <constructor-arg value="/api/accessDenied" index="0"/>
  </bean>

  <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder">
    <constructor-arg value="256"/>
  </bean>

  <bean id="userSaltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource">
    <property name="userPropertyToUse" value="passwordSalt" />
  </bean>

  <bean id="mailer" class="fr.smallcrew.utils.Mailer">
    <constructor-arg value="${mailer.hostname}"/>
    <constructor-arg value="${mailer.port}"/>
    <constructor-arg value="${mailer.login}"/>
    <constructor-arg value="${mailer.password}"/>
    <constructor-arg value="${mailer.useTLS}"/>
    <constructor-arg value="${mailer.from}"/>
  </bean>

  <bean class="fr.smallcrew.utils.MailerHelper">
    <constructor-arg ref="mailer"/>
    <constructor-arg ref="properties"/>
  </bean>

  <security:authentication-manager alias="authenticationManager">
    <security:authentication-provider user-service-ref="userService">
      <security:password-encoder ref="passwordEncoder">
        <security:salt-source ref="userSaltSource"/>
      </security:password-encoder>
    </security:authentication-provider>
  </security:authentication-manager>

  <jpa:repositories base-package="fr.smallcrew.security.repository"/>
</beans>





© 2015 - 2024 Weber Informatics LLC | Privacy Policy