Package com.adito.security

Examples of com.adito.security.User


    /**
     * @throws Exception
     */
    @Test
    public void checkResourceAccessViaRole() throws Exception {
        User user = createAccount();
        Role role = createRole();
        user = updateAccountRoles(user, Collections.singleton(role));
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        T resource = createResource();
View Full Code Here


    /**
     * @throws Exception
     */
    @Test
    public void checkAllAccessRightsViaRole() throws Exception {
        User user = createAccount();
        Role role = createRole();
        user = updateAccountRoles(user, Collections.singleton(role));
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        T resource = createResource();
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void checkNoAccessRightsViaRole() throws Exception {
        User user = createAccount();
        Role role = createRole();
        user = updateAccountRoles(user, Collections.singleton(role));
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        T resource = createResource();
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void checkDeleteAccessRightsViaRole() throws Exception {
        User user = createAccount();
        Role role = createRole();
        user = updateAccountRoles(user, Collections.singleton(role));
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        T resource = createResource();
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void checkCreateEditAssignAssignAccessRightsViaRole() throws Exception {
        User user = createAccount();
        Role role = createRole();
        user = updateAccountRoles(user, Collections.singleton(role));
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        T resource = createResource();
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void checkEditAssignAccessRightsViaRole() throws Exception {
        User user = createAccount();
        Role role = createRole();
        user = updateAccountRoles(user, Collections.singleton(role));
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        T resource = createResource();
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void checkAssignAccessRightsViaRole() throws Exception {
        User user = createAccount();
        Role role = createRole();
        user = updateAccountRoles(user, Collections.singleton(role));
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        T resource = createResource();
View Full Code Here

    @Test
    public void testFavorites() throws Exception{
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        T resource = createResource();
        User user = createAccount();
        PropertyList selectedPolicies = PropertyList.createFromArray(new int[] {policy.getResourceId()});
        PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(resource, selectedPolicies, getSessionInfo());
        getPolicyService().grantPolicyToPrincipal(policy, user);
       
        assertEquals("There should be no favorites", 0, SystemDatabaseFactory.getInstance().getFavorites(resource.getResourceType().getResourceTypeId(), user).size());
        SystemDatabaseFactory.getInstance().addFavorite(resource.getResourceType().getResourceTypeId(), resource.getResourceId(), user.getPrincipalName());
        assertEquals("There should now be one favorites", 1, SystemDatabaseFactory.getInstance().getFavorites(resource.getResourceType().getResourceTypeId(), user).size());
       
        Favorite favorite = SystemDatabaseFactory.getInstance().getFavorite(resource.getResourceType().getResourceTypeId(), user, resource.getResourceId());
        assertEquals("The favorite and resource id should match.", resource.getResourceId(), favorite.getFavoriteKey());
        assertEquals("The favorite username should match the users principle name.", user.getPrincipalName(), favorite.getUsername());
        assertEquals("The favorite type id and resource type id should match.", resource.getResourceType().getResourceTypeId(), favorite.getType());
       
        SystemDatabaseFactory.getInstance().removeFavorite(resource.getResourceType().getResourceTypeId(), resource.getResourceId(), user.getPrincipalName());
        assertEquals("There should be no favorites", 0, SystemDatabaseFactory.getInstance().getFavorites(resource.getResourceType().getResourceTypeId(), user).size());
       
        getPolicyService().revokePolicyFromPrincipal(policy, user);
        PolicyDatabaseFactory.getInstance().detachResourceFromPolicyList(resource, getSessionInfo());
        deleteResource(resource);
View Full Code Here

           
            try {
              UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(LogonControllerFactory.getInstance().getSessionInfo(request).getUser().getRealm());
                for (Iterator i = ((PropertyList) seq.getAttribute(PolicyPrincipalSelectionForm.ATTR_SELECTED_ACCOUNTS, null))
                                .iterator(); i.hasNext();) {
                    User user = udb.getAccount((String) i.next());
                    PolicyDatabaseFactory.getInstance().grantPolicyToPrincipal(pol,
                                    user);
                    CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.GRANT_POLICY_TO_PRINCIPAL, pol, getSessionInfo(request),
                            CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_TYPE, "user").addAttribute(
                            CoreAttributeConstants.EVENT_ATTR_POLICY_NAME,
                            pol.getResourceName()).addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_ID, user.getPrincipalName()));
                }
                for (Iterator i = ((PropertyList) seq.getAttribute(PolicyPrincipalSelectionForm.ATTR_SELECTED_ROLES, null))
                                .iterator(); i.hasNext();) {
                    Role role = udb.getRole((String) i.next());
                    PolicyDatabaseFactory.getInstance().grantPolicyToPrincipal(pol,
View Full Code Here

  private boolean handleReplacementProxy(RequestHandlerRequest request, RequestHandlerResponse response,
                      LaunchSession launchSession) throws Exception {

    int maxAge = Property.getPropertyInt(new SystemConfigKey("webForwards.cache.maxUserAge")) * 1000 * 60;
    User user = launchSession.getSession().getUser();
    ContentCache cache = getCache(launchSession.getSession(), user);
    CookieMap cookieMap = getCookieMap(launchSession);

    final RequestProcessor requestProcessor = new RequestProcessor(cache, maxAge, request, launchSession);

View Full Code Here

TOP

Related Classes of com.adito.security.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.