Examples of UserPrincipal


Examples of org.jboss.remoting3.security.UserPrincipal

        }

        Object credential = getCredential();
        if (credential instanceof RemotingConnectionCredential) {
            Connection con = ((RemotingConnectionCredential) credential).getConnection();
            UserPrincipal up = null;
            for (Principal current : con.getPrincipals()) {
                if (current instanceof UserPrincipal) {
                    up = (UserPrincipal) current;
                    break;
                }
View Full Code Here

Examples of org.jboss.resteasy.keystone.core.UserPrincipal

   }

   @Override
   protected Principal getIdentity()
   {
      Principal principal = new UserPrincipal(access.getUser());
      return principal;
   }
View Full Code Here

Examples of org.jspresso.framework.security.UserPrincipal

    Attributes attrs = ctx.getAttributes(userDN, null);

    NameParser nameParser = ctx.getNameParser(userDN);

    UserPrincipal userPrincipal = (UserPrincipal) getIdentity();

    for (Map.Entry<String, String> option : ((Map<String, String>) options)
        .entrySet()) {
      if (option.getKey().startsWith(CUSTOM_PROPERTY_OPT)) {
        String attributeId = option.getValue();
        if (option.getValue().contains(SLICE_START)) {
          String attributeIdBase = attributeId.substring(0, attributeId
              .indexOf(SLICE_START));

          String[] indices = option.getValue().substring(
              option.getValue().indexOf(SLICE_START) + 1,
              option.getValue().indexOf(SLICE_END)).split(
              SLICE_START + "," + SLICE_END);
          int startIndex = Integer.parseInt(indices[0]);
          int endIndex = Integer.parseInt(indices[1]);

          if ("DN".equalsIgnoreCase(attributeIdBase)) {
            String dnSlice = extractSlice(userDN, nameParser, startIndex,
                endIndex);
            int dotIndex = attributeId.indexOf(".");
            if (dotIndex > -1) {
              Attributes nestedAttrs = ctx.getAttributes(dnSlice, null);
              Attribute attr = nestedAttrs.get(attributeId
                  .substring(dotIndex + 1));
              if (attr != null && attr.size() > 0) {
                if (attr.size() == 1) {
                  userPrincipal.putCustomProperty(option.getKey().substring(
                      CUSTOM_PROPERTY_OPT.length()), attr.get());
                } else {
                  List<Object> values = new ArrayList<Object>();
                  for (NamingEnumeration<?> avne = attr.getAll(); avne
                      .hasMore();) {
                    values.add(avne.next());
                  }
                  userPrincipal.putCustomProperty(option.getKey().substring(
                      CUSTOM_PROPERTY_OPT.length()), values);
                }
              }
            } else {
              userPrincipal.putCustomProperty(option.getKey().substring(
                  CUSTOM_PROPERTY_OPT.length()), dnSlice);
            }
          } else {
            Attribute attr = attrs.get(attributeId);
            if (attr != null && attr.size() > 0) {
              if (attr.size() == 1) {
                userPrincipal.putCustomProperty(option.getKey().substring(
                    CUSTOM_PROPERTY_OPT.length()), extractSlice((String) attr
                    .get(), nameParser, startIndex, endIndex));
              } else {
                List<Object> values = new ArrayList<Object>();
                for (NamingEnumeration<?> avne = attr.getAll(); avne.hasMore();) {
                  values.add(extractSlice((String) avne.next(), nameParser,
                      startIndex, endIndex));
                }
                userPrincipal.putCustomProperty(option.getKey().substring(
                    CUSTOM_PROPERTY_OPT.length()), values);
              }
            }
          }
        } else {
          if ("DN".equalsIgnoreCase(attributeId)) {
            userPrincipal.putCustomProperty(option.getKey().substring(
                CUSTOM_PROPERTY_OPT.length()), userDN);
          } else {
            Attribute attr = attrs.get(attributeId);
            if (attr != null && attr.size() > 0) {
              if (attr.size() == 1) {
                userPrincipal.putCustomProperty(option.getKey().substring(
                    CUSTOM_PROPERTY_OPT.length()), attr.get());
              } else {
                List<Object> values = new ArrayList<Object>();
                for (NamingEnumeration<?> avne = attr.getAll(); avne.hasMore();) {
                  values.add(avne.next());
                }
                userPrincipal.putCustomProperty(option.getKey().substring(
                    CUSTOM_PROPERTY_OPT.length()), values);
              }
            }
          }
        }
View Full Code Here

Examples of org.jspresso.framework.security.UserPrincipal

   */
  @Override
  protected Principal createIdentity(String username) throws Exception {
    if (principalClassName == null && getIdentity() == null) {
      // we are creating the user principal.
      return new UserPrincipal(username);
    }
    return super.createIdentity(username);
  }
View Full Code Here

Examples of org.jspresso.framework.security.UserPrincipal

  public boolean commit() {
    if (!succeeded) {
      return false;
    }
    // assume the user we authenticated is the DemoPrincipal
    userPrincipal = new UserPrincipal(username);
    for (Map.Entry<String, ?> option : options.entrySet()) {
      if (option.getKey().startsWith(CUSTOM_PROPERTY_OPT + suffix)) {
        userPrincipal.putCustomProperty(option.getKey().substring(
            (CUSTOM_PROPERTY_OPT + suffix).length() + 1), option.getValue());
      }
View Full Code Here

Examples of org.sblim.wbem.client.UserPrincipal

   
   
    // *****************************
    // 1. Create user credentials
    // *****************************
    UserPrincipal userPr = new UserPrincipal(USER);
    char [] pwdCharArray = PWD.toCharArray();
    PasswordCredential pwCred = new PasswordCredential(pwdCharArray);     

    // *****************************
    // 2. Set NameSpace
View Full Code Here

Examples of org.switchyard.security.principal.UserPrincipal

    }

    private SecurityContext getContext() throws Exception {
        SecurityContext context = new DefaultSecurityContext();
        Subject subject = context.getSubject("testSecurityDomain");
        subject.getPrincipals().add(new UserPrincipal("testUser"));
        context.getCredentials().addAll(getCredentials());
        return context;
    }
View Full Code Here

Examples of org.uberfire.java.nio.file.attribute.UserPrincipal

        Files.getOwner( null );
    }

    @Test(expected = UnsupportedOperationException.class)
    public void setOwner() {
        Files.setOwner( newTempDir(), new UserPrincipal() {
            @Override
            public String getName() {
                return "name";
            }
        } );
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.