Package org.sonatype.security

Examples of org.sonatype.security.SecuritySystem.login()


  {
    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);
View Full Code Here


    securitySystem.start();

    // need to bind to a request
    // this.setupLoginContext( "testGetSubjectFromThread" );

    Assert.assertNotNull(securitySystem.login(new UsernamePasswordToken("jcoder", "jcoder")));

    // WebUtils.unbindServletRequest();
    // WebUtils.unbindServletResponse();
    //
    // now with the thread
View Full Code Here

    Subject subject = thread.getSubject();
    Assert.assertTrue(subject.hasRole("RoleA"));

    // if we login again with the jcoder user we should need to bind the request again
    try {
      securitySystem.login(new UsernamePasswordToken("jcoder", "jcoder"));
      Assert.fail("Expected IllegalStateException");
    }
    catch (IllegalStateException e) {
      // this is not a great exception to catch...
      // but we check the success on the next call
View Full Code Here

      // this is not a great exception to catch...
      // but we check the success on the next call
    }

    this.setupLoginContext("testGetSubjectFromThread-again");
    subject = securitySystem.login(new UsernamePasswordToken("jcoder", "jcoder"));
    Assert.assertNotNull(subject);

  }

  class SubjectRetrievingThread
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.