Examples of UserPrincipal


Examples of org.apache.servicemix.nmr.api.security.UserPrincipal

        destination.activate();
              
        assertNotNull(destination);
       
        Subject subject = new Subject();
        subject.getPrincipals().add(new UserPrincipal("ffang"));

        Channel channel = nmr.createChannel();
        org.apache.servicemix.nmr.api.Exchange exchange = channel.createExchange(Pattern.InOut);
        exchange.setTarget(
                nmr.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, "dumy")));
View Full Code Here

Examples of org.candlepin.auth.UserPrincipal

        return new User(username, password, superAdmin);
    }

    public static UserPrincipal createPrincipal(String username, Owner owner,
        Access role) {
        return new UserPrincipal(
            username,
            Arrays.asList(new Permission[]{ new OwnerPermission(owner, role) }),
            false);
    }
View Full Code Here

Examples of org.exoplatform.services.security.jaas.UserPrincipal

         // group principal
         principals.add(roleGroup);

         // username principal
         principals.add(new UserPrincipal(identity.getUserId()));

         return true;
      }
      else
      {
View Full Code Here

Examples of org.exoplatform.services.security.jaas.UserPrincipal

         // group principal
         principals.add(roleGroup);

         // username principal
         principals.add(new UserPrincipal(identity.getUserId()));

         return true;
      }
      else
      {
View Full Code Here

Examples of org.exoplatform.services.security.jaas.UserPrincipal

            // Now set the security context, which can be used in EJB or other calls
            if (samlCredential != null)
            {
               SecurityClient client = SecurityClientFactory.getSecurityClient();
               // Simple login just updates the security context
               client.setSimple(new UserPrincipal(httpRequest.getRemoteUser()), samlCredential);
               client.login();

               if (log.isTraceEnabled())
               {
                  log.trace("SecurityClient successfully updated with SAMLCredential");
View Full Code Here

Examples of org.exoplatform.services.security.jaas.UserPrincipal

         for (String role : identity.getRoles())
            principals.add(new RolePrincipal(role));

         // username principal
         principals.add(new UserPrincipal(identity.getUserId()));

         return true;
      }
      else
      {
View Full Code Here

Examples of org.fcrepo.server.security.jaas.auth.UserPrincipal

      logger.debug("Trying to set principal to new Principal with name="
          + principalNames[0]);

      // get name of principal and inject it into request
      // we use here a FeSL implementation of java.security.Principal
      UserPrincipal principal = new UserPrincipal(principalNames[0]);
      AuthHttpServletRequestWrapper authRequest = new AuthHttpServletRequestWrapper(
          req);
      authRequest.setUserPrincipal(principal);

      logger.debug("Principal has been set to " + principal);
View Full Code Here

Examples of org.jboss.as.core.security.api.UserPrincipal

    static final String SECURITY_TOKEN_KEY = ServerSecurityInterceptor.class.getName() + ".SecurityToken";

    @AroundInvoke
    public Object aroundInvoke(final InvocationContext invocationContext) throws Exception {
        Principal userPrincipal = null;
        UserPrincipal connectionUser = null;
        String authToken = null;

        Map<String, Object> contextData = invocationContext.getContextData();
        if (contextData.containsKey(SECURITY_TOKEN_KEY)) {
            authToken = (String) contextData.get(SECURITY_TOKEN_KEY);

            Collection<Principal> connectionPrincipals = SecurityActions.getConnectionPrincipals();

            if (connectionPrincipals != null) {
                for (Principal current : connectionPrincipals) {
                    if (current instanceof UserPrincipal) {
                        connectionUser = (UserPrincipal) current;
                        break;
                    }
                }
            }
            userPrincipal = new SimplePrincipal(connectionUser.getName());
        } else {
            throw new IllegalStateException("Token authentication requested but no user on connection found.");
        }

        ContextStateCache stateCache = null;
View Full Code Here

Examples of org.jboss.as.core.security.api.UserPrincipal

    static final String DELEGATED_USER_KEY = ServerSecurityInterceptor.class.getName() + ".DelegationUser";

    @AroundInvoke
    public Object aroundInvoke(final InvocationContext invocationContext) throws Exception {
        Principal desiredUser = null;
        UserPrincipal connectionUser = null;

        Map<String, Object> contextData = invocationContext.getContextData();
        if (contextData.containsKey(DELEGATED_USER_KEY)) {
            desiredUser = new SimplePrincipal((String) contextData.get(DELEGATED_USER_KEY));

            Collection<Principal> connectionPrincipals = SecurityActions.getConnectionPrincipals();

            if (connectionPrincipals != null) {
                for (Principal current : connectionPrincipals) {
                    if (current instanceof UserPrincipal) {
                        connectionUser = (UserPrincipal) current;
                        break;
                    }
                }

            } else {
                throw new IllegalStateException("Delegation user requested but no user on connection found.");
            }
        }


        ContextStateCache stateCache = null;
        try {
            if (desiredUser != null && connectionUser != null
                && (desiredUser.getName().equals(connectionUser.getName()) == false)) {
                // The final part of this check is to verify that the change does actually indicate a change in user.
                try {
                    // We have been requested to use an authentication token
                    // so now we attempt the switch.
                    stateCache = SecurityActions.pushIdentity(desiredUser, new OuterUserCredential(connectionUser));
View Full Code Here

Examples of org.jboss.dashboard.security.principals.UserPrincipal

    protected Set<Principal> calculateUserPrincipals() {
        if (log.isDebugEnabled()) log.debug("Calculating principals for current user.");

        Set<Principal> principals = new HashSet<Principal>();
        if (userLogin != null) principals.add(new UserPrincipal(userLogin));
        if (!isRootUser()) {
            RolesManager rolesManager = SecurityServices.lookup().getRolesManager();
            for (Role role : rolesManager.getAllRoles()) {
                Principal rolePrincipal = null;
                if (userRoleIds.contains(role.getName())) rolePrincipal = new RolePrincipal(role);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.