1 /* 2 * JBoss, the OpenSource J2EE webOS 3 * 4 * Distributable under LGPL license. 5 * See terms of license at gnu.org. 6 */ 7 8 package org.jboss.security; 9 10 import java.security.Principal; 11 import java.util.Set; 12 13 /** The interface for Principal mapping. It defines the mapping from the 14 operational environment Principal to the application domain principal via 15 the {@link #getPrincipal(Principal) getPrincipal} method. It also defines 16 the method for validating the application domain roles to which the operational 17 environment Principal belongs via the {@link #getPrincipal(Principal) getPrincipal} 18 method. 19 20 @author Scott.Stark@jboss.org 21 @version $Revision: 1.8 $ 22 */ 23 public interface RealmMapping 24 { 25 /** Map from the operational environment Principal to the application 26 domain principal. This is used by the EJBContext.getCallerPrincipal implentation 27 to map from the authenticated principal to a principal in the application 28 domain. 29 @param principal the caller principal as known in the operation environment. 30 @return the principal 31 */ 32 public Principal getPrincipal(Principal principal); 33 34 /** Validates the application domain roles to which the operational 35 environment Principal belongs. 36 @param principal the caller principal as known in the operation environment. 37 @param roles The Set<Principal> for the application domain roles that the 38 principal is to be validated against. 39 @return true if the principal has at least one of the roles in the roles set, 40 false otherwise. 41 */ 42 public boolean doesUserHaveRole(Principal principal, Set roles); 43 44 /** Return the set of domain roles the principal has been assigned. 45 @return The Set<Principal> for the application domain roles that the 46 principal has been assigned. 47 */ 48 public Set getUserRoles(Principal principal); 49 } 50