Package org.apache.wicket.security.hive.authentication

Examples of org.apache.wicket.security.hive.authentication.DefaultSubject


   *      java.lang.String)
   */
  protected Subject getSubject(String username, String password) throws LoginException
  {
    // TODO verify username, password, if user is not authenticated throw a LoginException
    DefaultSubject subject = new DefaultSubject();
    // grant principals to the user based on .....
    subject.addPrincipal(new SimplePrincipal("something"));
    return subject;
  }
View Full Code Here


  public Subject login() throws LoginException
  {
    // irrelevant check
    if (username != null && Objects.equal(username, password))
    {
      DefaultSubject subject = new DefaultSubject();
      if ("super".equals(username))
      {
        subject.addPrincipal(new MyPrincipal("super"));
        subject.addPrincipal(new MyPrincipal("basic"));
      }
      else
        subject.addPrincipal(new MyPrincipal("basic"));
      return subject;
    }
    throw new LoginException("Username and password do not match any known user.");
  }
View Full Code Here

  @Override
  protected Subject getSubject(String username, String password) throws LoginException
  {
    if (username != null && Objects.equal(username, password))
    {
      DefaultSubject subject = new DefaultSubject();
      subject.addPrincipal(new SimplePrincipal("user"));

      if (username.equalsIgnoreCase("admin"))
      {
        subject.addPrincipal(new SimplePrincipal("admin"));
      }
      return subject;
    }
    throw new LoginException("Username and password do not match any known user.");
  }
View Full Code Here

  @Override
  protected Subject getSubject(String username, String password)
  {
    // TODO verify username, password, if user is not authenticated throw a
    // LoginException
    DefaultSubject subject = new DefaultSubject();
    // grant principals to the user based on .....
    subject.addPrincipal(new SimplePrincipal("something"));
    return subject;
  }
View Full Code Here

  public Subject login() throws LoginException
  {
    // irrelevant check
    if (username != null && Objects.equal(username, password))
    {
      DefaultSubject subject = new DefaultSubject();
      if ("ceo".equals(username))
      {
        subject.addPrincipal(new MyPrincipal("organisation.rights"));
      }
      else
        subject.addPrincipal(new MyPrincipal("department.rights"));
      return subject;
    }
    throw new LoginException("Username and password do not match any known user.");
  }
View Full Code Here

  {
    // irrelevant check
    if (Objects.equal(username, token))
    {
      // usually there will be a db call to verify the credentials
      DefaultSubject subject = new MySecondarySubject();
      // add principals as required
      // Note if topsecret implied basic we would not have to add it here.
      // Also we only need this because we can login through a
      // bookmarkable url, thereby bypassing the first login page.
      // if we know we always come through the first loginpage we can
      // remove basic here.
      subject.addPrincipal(new MyPrincipal("basic"));
      subject.addPrincipal(new MyPrincipal("topsecret"));
      return subject;
    }
    throw new LoginException("username does not match token");
  }
View Full Code Here

  {
    // irrelevant check
    if (Objects.equal(username, password))
    {
      // usually there will be a db call to verify the credentials
      DefaultSubject subject = new MyPrimarySubject();
      // add principals as required, usually these come from a db
      subject.addPrincipal(new MyPrincipal("basic"));
      return subject;
    }
    throw new LoginException("username does not match password");
  }
View Full Code Here

  public Subject login()
  {
    // username password combo is already verified, just get the user object
    // and create a subject for it
    // getting the user object is being skipped in this example
    DefaultSubject subject = new DefaultSubject();
    subject.addPrincipal(new MyPrincipal("digest"));
    return subject;
  }
View Full Code Here

  protected Subject getSubject(String username, String password) throws LoginException
  {
    // irrelevant check
    if (username != null && Objects.equal(username, password))
    {
      DefaultSubject subject = new DefaultSubject();
      subject.addPrincipal(new MyPrincipal("basic"));
      return subject;
    }
    throw new LoginException("Username and password do not match any known user.");
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.security.hive.authentication.DefaultSubject

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.