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

com.power4j.fist.boot.security.oauth2.Oauth2AuthenticatedPrincipal Maven / Gradle / Ivy

The newest version!
package com.power4j.fist.boot.security.oauth2;

import com.power4j.fist.boot.security.core.AuthenticatedObject;
import com.power4j.fist.security.core.authorization.domain.GrantedPermission;
import org.springframework.lang.Nullable;

import java.util.Collection;
import java.util.Map;

/**
 * @author CJ ([email protected])
 * @since 2022.1
 */
public interface Oauth2AuthenticatedPrincipal extends AuthenticatedObject {

	/**
	 * Get the OAuth 2.0 token attribute by name
	 * @param name the name of the attribute
	 * @param  the type of the attribute
	 * @return the attribute or {@code null} otherwise
	 */
	@Nullable
	@SuppressWarnings("unchecked")
	default  A getAttribute(String name) {
		return (A) getAttributes().get(name);
	}

	/**
	 * Get the OAuth 2.0 token attributes
	 * @return the OAuth 2.0 token attributes
	 */
	Map getAttributes();

	/**
	 * Get the {@link Collection} of {@link GrantedPermission}s associated with this OAuth
	 * 2.0 token
	 * @return the OAuth 2.0 token authorities
	 */
	Collection getAuthorities();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy