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

cn.watsontech.webhelper.common.security.authentication.AuthenticationWithToken Maven / Gradle / Ivy

package cn.watsontech.webhelper.common.security.authentication;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;

import java.util.Collection;

public class AuthenticationWithToken extends PreAuthenticatedAuthenticationToken {
    public AuthenticationWithToken(Object aPrincipal, Object aCredentials) {
        super(aPrincipal, aCredentials);
        setAuthenticated(aPrincipal!=null);
    }

    public AuthenticationWithToken(Object aPrincipal, Object aCredentials, Collection anAuthorities) {
        super(aPrincipal, aCredentials, anAuthorities);
    }

    @Autowired
    public void setToken(String token) {
        setDetails(token);
    }

    @Autowired
    public String getToken() {
        return (String)getDetails();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy