001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2015 ForgeRock AS.
016 */
017package org.opends.server.protocols.jmx;
018
019import java.security.Principal;
020
021/**
022 * Represents a Ldap authentication ID used for JMX connection authentication.
023 */
024public class OpendsJmxPrincipal implements Principal
025{
026  /** The authentication ID. */
027  private String authID;
028
029
030  /**
031   * Create a new OpendsJmxPrincipal object.
032   *
033   * @param authID The JMX Connection ID to be registered into
034   * this Object.
035   */
036  public OpendsJmxPrincipal(String authID)
037  {
038    this.authID = authID;
039  }
040
041
042  /** {@inheritDoc} */
043  @Override
044  public boolean equals(Object another)
045  {
046    return authID.equals(another);
047  }
048
049  /** {@inheritDoc} */
050  @Override
051  public int hashCode()
052  {
053    return authID.hashCode() ;
054  }
055
056  /** {@inheritDoc} */
057  @Override
058  public String toString()
059  {
060    return authID;
061  }
062
063  /** {@inheritDoc} */
064  public String getName()
065  {
066    return authID;
067  }
068}