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

com.minlia.rocket.security.authentication.provider.SecurityAuthenticationProvider Maven / Gradle / Ivy

There is a newer version: 2.0.4.1.RELEASE
Show newest version
package com.minlia.rocket.security.authentication.provider;

import com.minlia.rocket.security.authentication.service.AuthenticationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
@Transactional
public class SecurityAuthenticationProvider implements AuthenticationProvider {

  @Autowired
  private AuthenticationService authenticationService;

  /**
   * 具体实现请参见 @see RbacAuthenticationService
   */
  @Override
  public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    return authenticationService.authentication(authentication);
  }

  @Override
  public boolean supports(Class authentication) {
    return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy