Package org.apache.catalina.realm

Examples of org.apache.catalina.realm.GenericPrincipal


    */
   protected Set<Principal> getPrincipalRoles(Principal principal)
   {
      if ((principal instanceof GenericPrincipal) == false)
         throw new IllegalStateException("Expected GenericPrincipal, but saw: " + principal.getClass());
      GenericPrincipal gp = (GenericPrincipal) principal;
      String[] roleNames = gp.getRoles();
      Set<Principal> userRoles = new HashSet<Principal>();
      if (roleNames != null)
      {
         for (int n = 0; n < roleNames.length; n++)
         {
View Full Code Here


       
        Set<String> roles = oauthProvider.convertPermissionsToRoles(accessToken.getPermissions());
        Realm realm = new OAuthRealm(roles);
        context.setRealm(realm);
       
        final Principal principal = new GenericPrincipal(realm, consumer.getKey(), "", new ArrayList<String>(roles));
        ((Request)request).setUserPrincipal(principal);
        ((Request)request).setAuthType("OAuth");
    }
View Full Code Here

            return "";
        }

        @Override
        protected Principal getPrincipal(String username) {
            return new GenericPrincipal(this, username, "", null, null);
        }
View Full Code Here

                fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
            }

            // Call the logout method
            if (principal instanceof GenericPrincipal) {
                GenericPrincipal gp = (GenericPrincipal) principal;
                try {
                    gp.logout();
                } catch (Exception e) {
                    manager.getContainer().getLogger().error(
                            sm.getString("standardSession.logoutfail"),
                            e);
                }
View Full Code Here

                                         principal.getUserPrincipal()!=principal?principal.getUserPrincipal():null);
    }

    public GenericPrincipal getPrincipal( Realm realm )
    {
        return new GenericPrincipal(realm, name, password,
                getRoles()!=null?Arrays.asList(getRoles()):null,
                userPrincipal);
    }
View Full Code Here

                log.error(sm.getString(
                        "serializablePrincipal.readPrincipal.cnfe"), e);
                throw e;
            }
        }
        return new GenericPrincipal(realm,name,pwd,Arrays.asList(roles),
                userPrincipal);
    }
View Full Code Here

        if (session != null) {
            session.setPrincipal(null);
            session.setAuthType(null);
        }
        if (principal instanceof GenericPrincipal) {
            GenericPrincipal gp = (GenericPrincipal) principal;
            try {
                gp.logout();
            } catch (Exception e) {
                throw new ServletException(sm.getString("coyoteRequest.logoutfail"), e);
            }
        }
    }
View Full Code Here

        } else {
            userPrincipal = null;
            authType = null;
        }
        if (principal instanceof GenericPrincipal) {
            GenericPrincipal gp = (GenericPrincipal) principal;
            try {
                gp.logout();
            } catch (Exception e) {
                throw new ServletException(sm.getString("coyoteRequest.logoutfail"), e);
            }
        }
    }
View Full Code Here

                fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
            }

            // Call the logout method
            if (principal instanceof GenericPrincipal) {
                GenericPrincipal gp = (GenericPrincipal) principal;
                try {
                    gp.logout();
                } catch (Exception e) {
                    manager.getContainer().getLogger().error(
                            sm.getString("standardSession.logoutfail"),
                            e);
                }
View Full Code Here

     * @return a possible null Set<Principal> for the caller roles
     */
    protected Set<Principal> getPrincipalRoles(Principal principal) {
        if (!(principal instanceof GenericPrincipal))
            throw MESSAGES.illegalPrincipalType(principal.getClass());
        GenericPrincipal gp = GenericPrincipal.class.cast(principal);
        String[] roleNames = gp.getRoles();
        Set<Principal> userRoles = new HashSet<Principal>();
        if (roleNames != null) {
            for (int n = 0; n < roleNames.length; n++) {
                Principal sp = getPrincipal(roleNames[n]);
                userRoles.add(sp);
View Full Code Here

TOP

Related Classes of org.apache.catalina.realm.GenericPrincipal

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.