@@ -0,0 +1,1624 @@
+package org.jasig.portal.security;%0A%0Aimport org.apache.commons.lang3.Validate;%0Aimport org.jasig.portal.EntityIdentifier;%0Aimport org.jasig.portal.services.AuthorizationService;%0A%0A/**%0A * Static convenience methods for working with IAuthorizationPricipal.%0A *%0A * Currently offers one method which encapsulates the magic for%0A * converting a uPortal IPerson to an IAuthorizationPrincipal.%0A *%0A * @since uPortal 4.1%0A */%0Apublic final class AuthorizationPrincipalHelper %7B%0A%0A    /**%0A     * Convenience method for converting an IPerson to an IAuthorizationPrincipal.%0A     * @param user a non-null valid IPerson%0A     * @return an IAuthorizationPrincipal representing that user%0A     * @throws IllegalArgumentException if the user object is null or defective.%0A     * @since uPortal 4.1%0A     */%0A    public static IAuthorizationPrincipal principalFromUser(final IPerson user) %7B%0A%0A        Validate.notNull(user, %22Cannot determine marketplace entries for null user.%22);%0A%0A        final EntityIdentifier userEntityIdentifier = user.getEntityIdentifier();%0A        Validate.notNull(user, %22The user object is defective: lacks entity identifier.%22);%0A%0A        final String userEntityKey = userEntityIdentifier.getKey();%0A        Validate.notNull(userEntityKey, %22The user object is defective: lacks entity key.%22);%0A        final Class userEntityType = userEntityIdentifier.getType();%0A        Validate.notNull(userEntityType, %22The user object is defective: lacks entity type.%22);%0A%0A        final IAuthorizationPrincipal principal =%0A                AuthorizationService.instance().newPrincipal(userEntityKey, userEntityType);%0A%0A        return principal;%0A%0A    %7D%0A%0A%7D%0A

Add AuthorizationPrincipalHelper.