Class AuthHandler

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.MessageSourceAware, org.springframework.security.authentication.AuthenticationProvider

    @Component
    public class AuthHandler
    extends org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
    Contacts auth server to verify token validity. Tasks: 1. Contacts auth server to verify token validity. 2. Stores the response body in an instance of MosipUserDto. 3. Updates token into in the security context through AuthUserDetails. 4. Bind MosipUserDto instance details with the AuthUserDetails that extends Spring Security's UserDetails.
    Since:
    1.0.0
    Author:
    Ramadurai Saravana Pandian, Raj Jha, Urvil Joshi
    • Field Summary

      • Fields inherited from class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider

        hideUserNotFoundExceptions, logger, messages
    • Constructor Summary

      Constructors 
      Constructor Description
      AuthHandler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void additionalAuthenticationChecks​(org.springframework.security.core.userdetails.UserDetails userDetails, org.springframework.security.authentication.UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken)  
      protected org.springframework.security.core.userdetails.UserDetails retrieveUser​(String userName, org.springframework.security.authentication.UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken)  
      • Methods inherited from class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider

        afterPropertiesSet, authenticate, createSuccessAuthentication, doAfterPropertiesSet, getPostAuthenticationChecks, getPreAuthenticationChecks, getUserCache, isForcePrincipalAsString, isHideUserNotFoundExceptions, setAuthoritiesMapper, setForcePrincipalAsString, setHideUserNotFoundExceptions, setMessageSource, setPostAuthenticationChecks, setPreAuthenticationChecks, setUserCache, supports
    • Constructor Detail

      • AuthHandler

        public AuthHandler()
    • Method Detail

      • additionalAuthenticationChecks

        protected void additionalAuthenticationChecks​(org.springframework.security.core.userdetails.UserDetails userDetails,
                                                      org.springframework.security.authentication.UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken)
                                               throws org.springframework.security.core.AuthenticationException
        Specified by:
        additionalAuthenticationChecks in class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
        Throws:
        org.springframework.security.core.AuthenticationException
      • retrieveUser

        protected org.springframework.security.core.userdetails.UserDetails retrieveUser​(String userName,
                                                                                         org.springframework.security.authentication.UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken)
                                                                                  throws org.springframework.security.core.AuthenticationException
        Specified by:
        retrieveUser in class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
        Throws:
        org.springframework.security.core.AuthenticationException