All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.vt.middleware.ldap.jaas.LdapCredential Maven / Gradle / Ivy

/*
  $Id: LdapCredential.java 1330 2010-05-23 22:10:53Z dfisher $

  Copyright (C) 2003-2010 Virginia Tech.
  All rights reserved.

  SEE LICENSE FOR MORE INFORMATION

  Author:  Middleware Services
  Email:   [email protected]
  Version: $Revision: 1330 $
  Updated: $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
*/
package edu.vt.middleware.ldap.jaas;

import java.io.Serializable;

/**
 * LdapCredential provides a custom implementation for adding LDAP
 * credentials to a Subject.
 *
 * @author  Middleware Services
 * @version  $Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
 */
public class LdapCredential implements Serializable
{

  /** hash code seed. */
  protected static final int HASH_CODE_SEED = 89;

  /** serial version uid. */
  private static final long serialVersionUID = 6571981350905290712L;

  /** LDAP credential. */
  private Object credential;


  /**
   * This creates a new LdapCredential with the supplied
   * credential.
   *
   * @param  credential  Object
   */
  public LdapCredential(final Object credential)
  {
    this.credential = credential;
  }


  /**
   * This returns the credential for this LdapCredential.
   *
   * @return  Object
   */
  public Object getCredential()
  {
    return this.credential;
  }


  /**
   * This returns the supplied Object is equal to this 
   * LdapCredential.
   *
   * @param  o  Object
   *
   * @return  boolean
   */
  public boolean equals(final Object o)
  {
    if (o == null) {
      return false;
    }
    return
      o == this ||
        (this.getClass() == o.getClass() && o.hashCode() == this.hashCode());
  }


  /**
   * This returns the hash code for this LdapPrincipal.
   *
   * @return  int
   */
  public int hashCode()
  {
    int hc = HASH_CODE_SEED;
    if (this.credential != null) {
      hc += this.credential.hashCode();
    }
    return hc;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy