org.seedstack.seed.security.Realm Maven / Gradle / Ivy
/**
* Copyright (c) 2013-2016, The SeedStack authors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.security;
import java.util.Collection;
import java.util.Set;
import org.seedstack.seed.security.principals.PrincipalProvider;
/**
* A realm is used to authenticate and retrieve authorization for a user.
*
* @author [email protected]
*
*/
public interface Realm {
/**
* Get the roles
*
* @param identityPrincipal
* principal representing the identity of the user
* @param otherPrincipals
* other principals
* @return the roles of the user. Should not return null but empty
* collection.
*/
Set getRealmRoles(PrincipalProvider> identityPrincipal, Collection> otherPrincipals);
/**
* Authenticates the user and retrieves its properties in an
* {@link AuthenticationInfo}
*
* @param token
* the credentials
* @return the authentication of the user
* @throws AuthenticationException
* if the user cannot be authenticated.
*/
AuthenticationInfo getAuthenticationInfo(AuthenticationToken token) throws AuthenticationException;
/**
* Retrieves the RoleMapping associated to this realm
*
* @return the RoleMapping
*/
RoleMapping getRoleMapping();
/**
* Retrieves the RolePermissionResolver associated to this realm
*
* @return the RolePermissionResolver
*/
RolePermissionResolver getRolePermissionResolver();
/**
* Indicates the authentication token supported by this realm
*
* @return the class of AuthenticationToken supported
*/
Class extends AuthenticationToken> supportedToken();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy