title: How to configure Custom Authentication and Authorization in spring boot?
body: <p>We have a CutomAuthentication class implementing from AuthenticationProvider and we have one CutomAccessDecisionMgr class impl AccessDecisionManager. How can I register them in the application in java configuration ? </p>
  
  <p>In my xml I have           </p>
  
  <p>
          
          
          
          
      </p>
  
  <pre><code>&lt;beans:bean id="filterSecurityInterceptor" class="org.springframework.security.web.access.intercept.FilterSecurityInterceptor"&gt;
      &lt;beans:property name="accessDecisionManager" ref="accessDecisionManager" /&gt;
      &lt;beans:property name="authenticationManager" ref="authenticationManager" /&gt;
      &lt;beans:property name="securityMetadataSource" ref="securityMetadataSource" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;authentication-manager alias="authenticationManager" xmlns="http://www.springframework.org/schema/security"&gt;
          &lt;authentication-provider ref="customAuthentication"&gt;&lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  
  &lt;beans:bean name="accessDecisionManager" class="com.xy.dashboard.security.CustomAccessDecisionManager" &gt;&lt;/beans:bean&gt;
  
  &lt;beans:bean name="securityMetadataSource" class="com.xy.dashboard.security.InvocationSecurityMetadataSourceService"&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean id="customAuthentication" class="com.xy.dashboard.security.CustomAuthentication" /&gt;
  
  &lt;beans:bean id="securityExceptionTranslationHandler" class="org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler"&gt;
      &lt;beans:property name="exceptionMappings"&gt;
          &lt;beans:props&gt;
              &lt;beans:prop key="org.springframework.security.authentication.CredentialsExpiredException"&gt;/changepassword.xhtml&lt;/beans:prop&gt;
          &lt;/beans:props&gt;
      &lt;/beans:property&gt;
      &lt;beans:property name="defaultFailureUrl" value="/login.jsp" /&gt;
  &lt;/beans:bean&gt;
  </code></pre>