br.com.anteros.security.spring.AnterosSecurityOAuth2Authentication Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Anteros-Security-Spring Show documentation
Show all versions of Anteros-Security-Spring Show documentation
Anteros Security Spring for Java.
package br.com.anteros.security.spring;
import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
public class AnterosSecurityOAuth2Authentication extends OAuth2Authentication {
private Object principal;
private Collection authorities;
public AnterosSecurityOAuth2Authentication(Object principal, OAuth2Authentication auth,
Collection authorities) {
super(auth.getOAuth2Request(),auth);
this.principal = principal;
this.authorities = authorities;
}
@Override
public Object getPrincipal() {
return this.getUserAuthentication() == null ? this.getOAuth2Request().getClientId() : principal;
}
@Override
public Collection getAuthorities() {
return authorities;
}
}