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

br.com.anteros.security.spring.AnterosSecurityOAuth2Authentication Maven / Gradle / Ivy

There is a newer version: 2.0.20
Show newest version
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;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy