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.types; 018 019 020 021/** 022 * This enumeration defines the set of possible authentication types 023 * that may be used for a bind request. This is based on the LDAP 024 * specification defined in RFC 2251. 025 */ 026@org.opends.server.types.PublicAPI( 027 stability=org.opends.server.types.StabilityLevel.UNCOMMITTED, 028 mayInstantiate=false, 029 mayExtend=false, 030 mayInvoke=true) 031public enum AuthenticationType 032{ 033 /** 034 * The authentication type that indicates that the user will be 035 * performing simple authentication (i.e., just a password). 036 */ 037 SIMPLE((byte) 0x80), 038 039 040 041 /** 042 * The authentication type that indicates that the user will be 043 * performing SASL authentication using some extensible mechanism. 044 */ 045 SASL((byte) 0xA3), 046 047 048 049 /** 050 * The authentication type that indicates that the associated 051 * connection is an internal connection. 052 */ 053 INTERNAL((byte) 0xFF); 054 055 056 057 /** The BER type tag that is associated with this authentication type. */ 058 private byte berType; 059 060 061 062 /** 063 * Creates a new authentication type with the provided BER type tag. 064 * 065 * @param berType The BER type tag that is associated with this 066 * authentication type. 067 */ 068 private AuthenticationType(byte berType) 069 { 070 this.berType = berType; 071 } 072 073 074 075 /** 076 * Retrieves the BER type tag associated with this authentication 077 * type. 078 * 079 * @return The BER type tag associated with this authentication 080 * type. 081 */ 082 public int getBERType() 083 { 084 return berType; 085 } 086 087 088 089 /** 090 * Retrieves a string representation of this authentication type. 091 * 092 * @return A string representation of this authentication type. 093 */ 094 public String toString() 095 { 096 switch (berType) 097 { 098 case (byte) 0x80: 099 return "Simple"; 100 case (byte) 0xA3: 101 return "SASL"; 102 case (byte) 0xFF: 103 return "Internal"; 104 default: 105 return "Unknown"; 106 } 107 } 108} 109