Examples of SecuritySystem


Examples of org.codehaus.plexus.redback.system.SecuritySystem

        SecuritySession securitySession =
            (SecuritySession) context.getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );

        try
        {
            SecuritySystem securitySystem = (SecuritySystem) container.lookup( SecuritySystem.ROLE );

            if ( !securitySystem.isAuthorized( securitySession, ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION,
                                               project.getProjectGroupName() ) )
            {
                return false;
            }
        }
View Full Code Here

Examples of org.codehaus.plexus.redback.system.SecuritySystem

        SecuritySession securitySession =
            (SecuritySession) context.getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );

        try
        {
            SecuritySystem securitySystem = (SecuritySystem) container.lookup( SecuritySystem.ROLE );

            if ( !securitySystem.isAuthorized( securitySession, ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION,
                                               project.getProjectGroupName() ) )
            {
                return false;
            }
        }
View Full Code Here

Examples of org.sonatype.security.SecuritySystem

  protected PlexusRoleResource securityToRestModel(RoleIdentifier role) {
    // TODO: We shouldn't be looking up the role name here anyway... this should get pushed up to the
    // SecuritySystem.
    String roleName = role.getRoleId();

    SecuritySystem securitySystem = this.getSecuritySystem();

    try {
      AuthorizationManager authzManager = securitySystem.getAuthorizationManager(DEFAULT_SOURCE);
      roleName = authzManager.getRole(role.getRoleId()).getName();
    }
    catch (NoSuchAuthorizationManagerException e) {
      this.getLogger().warn("Failed to lookup the users Role: " + role.getRoleId() + " source: "
          + role.getSource() + " but the user has this role.", e);
View Full Code Here

Examples of org.sonatype.security.SecuritySystem

  @Test
  public void testGetUserFromUserManager()
      throws Exception
  {

    SecuritySystem securitySystem = this.getSecuritySystem();
    securitySystem.start();
    User user = securitySystem.getUser("cstamas");
    Assert.assertNotNull(user);
    Assert.assertEquals("cstamas", user.getUserId());
    Assert.assertEquals("cstamas@sonatype.com", user.getEmailAddress());
    Assert.assertEquals("Tamas Cservenak", user.getName());
View Full Code Here

Examples of org.sonatype.security.SecuritySystem

      throws Exception
  {
    IOUtils.copy(getClass().getResourceAsStream("/test-conf/etc/security-users-in-both-realms.xml"),
        new FileOutputStream(getNexusSecurityConfiguration()));

    SecuritySystem securitySystem = this.getSecuritySystem();
    securitySystem.start();

    List<String> realms = new ArrayList<String>();
    realms.add("XmlAuthenticatingRealm");
    realms.add(LdapPlugin.REALM_NAME);

    securitySystem.setRealms(realms);

    // the user developer is in both realms, we need to make sure the order is honored
    User user = securitySystem.getUser("brianf");
    Assert.assertEquals("default", user.getSource());

    realms.clear();
    realms.add(LdapPlugin.REALM_NAME);
    realms.add("XmlAuthenticatingRealm");
    securitySystem.setRealms(realms);

    // now the user should belong to the LDAP realm

    user = securitySystem.getUser("brianf");
    Assert.assertEquals("LDAP", user.getSource());

  }
View Full Code Here

Examples of org.sonatype.security.SecuritySystem

  }

  public void testInvalidRoleMapping()
      throws Exception
  {
    SecuritySystem userManager = this.getSecuritySystem();

    User user = userManager.getUser("jcoder");
    Assert.assertNotNull(user);

    Set<String> roleIds = new HashSet<String>();
    for (RoleIdentifier role : user.getRoles()) {
      Assert.assertNotNull("User has null role.", role);
View Full Code Here

Examples of org.sonatype.security.SecuritySystem

  }

  public void testListUsers()
      throws Exception
  {
    SecuritySystem userManager = this.getSecuritySystem();
    UserSearchCriteria criteria = new UserSearchCriteria(null, null, "MockUserManagerA");
    Set<User> users = userManager.searchUsers(criteria);

    Map<String, User> userMap = this.toUserMap(users);

    User user = userMap.get("jcoder");
    Assert.assertNotNull(user);
View Full Code Here

Examples of org.sonatype.security.SecuritySystem

  }

  private User searchForSingleUser(UserSearchCriteria criteria, String userId, String source)
      throws Exception
  {
    SecuritySystem userManager = this.getSecuritySystem();

    criteria.setSource(source);
    Set<User> users = userManager.searchUsers(criteria);

    Map<String, User> userMap = this.toUserMap(users);

    Assert.assertTrue("More then 1 User was returned: " + userMap.keySet(), users.size() <= 1);
View Full Code Here

Examples of org.sonatype.security.SecuritySystem

    getApplicationConfiguration().saveConfiguration();

    // setup security
    // setup security
    final SecuritySystem securitySystem = this.lookup(SecuritySystem.class);
    securitySystem.setRealms(Collections.singletonList("default"));
  }
View Full Code Here

Examples of org.sonatype.security.SecuritySystem

  private StorageItem getItem(String username, String repositoryId, String path)
      throws AuthenticationException, Exception
  {
    WebSecurityUtil.setupWebContext(username + "-" + repositoryId + "-" + path);

    SecuritySystem securitySystem = this.lookup(SecuritySystem.class);

    Subject subject = securitySystem.login(new UsernamePasswordToken(username, ""));

    Repository repo = this.getRepositoryRegistry().getRepository(repositoryId);

    ResourceStoreRequest request = new ResourceStoreRequest(path, false);

    StorageItem item = repo.retrieveItem(request);

    // not sure if we really need to log the user out, we are not using a remember me,
    // but what can it hurt?
    securitySystem.logout(subject);

    return item;
  }
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.