0N/A/*
0N/A * CDDL HEADER START
0N/A *
0N/A * The contents of this file are subject to the terms of the
0N/A * Common Development and Distribution License, Version 1.0 only
0N/A * (the "License"). You may not use this file except in compliance
0N/A * with the License.
0N/A *
0N/A * You can obtain a copy of the license at
0N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
0N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
0N/A * See the License for the specific language governing permissions
0N/A * and limitations under the License.
0N/A *
0N/A * When distributing Covered Code, include this CDDL HEADER in each
0N/A * file and include the License file at
0N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
0N/A * add the following below this CDDL HEADER, with the fields enclosed
873N/A * by brackets "[]" replaced with your own identifying information:
0N/A * Portions Copyright [yyyy] [name of copyright owner]
0N/A *
0N/A * CDDL HEADER END
0N/A *
0N/A *
3231N/A * Copyright 2006-2008 Sun Microsystems, Inc.
0N/A */
0N/Apackage org.opends.server.extensions;
0N/A
0N/A
0N/A
0N/A/**
0N/A * This class implements an enumeration that may be used to indicate if/how a
0N/A * client's certificate should be validated against the corresponding user entry
0N/A * in the Directory Server.
0N/A */
0N/Apublic enum CertificateValidationPolicy
0N/A{
0N/A /**
0N/A * Indicates that the server should always attempt to validate the client
0N/A * certificate against the version in the corresponding user's entry. If no
0N/A * certificates exist in the user's entry, then the validation will fail.
0N/A */
0N/A ALWAYS("always"),
0N/A
0N/A
0N/A
0N/A /**
0N/A * Indicates that the server should not attempt to validate the client
0N/A * certificate against the version in the corresponding user's entry.
0N/A */
0N/A NEVER("never"),
0N/A
0N/A
0N/A
0N/A /**
0N/A * Indicates that the server should attempt to validate the client certificate
0N/A * against the version in the corresponding user's entry if there are any
0N/A * certificates in that user's entry. If the user's entry does not contain
0N/A * any certificates, then no validation will be attempted.
0N/A */
0N/A IFPRESENT("ifpresent");
0N/A
0N/A
0N/A
0N/A // The human-readable name for this policy.
0N/A private String policyName;
0N/A
0N/A
0N/A
0N/A /**
0N/A * Creates a new certificate validation policy with the provided name.
0N/A *
0N/A * @param policyName The human-readable name for this policy.
0N/A */
0N/A private CertificateValidationPolicy(String policyName)
0N/A {
0N/A this.policyName = policyName;
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves the certificate validation policy for the specified name.
0N/A *
0N/A * @param policyName The name of the policy to retrieve.
0N/A *
0N/A * @return The requested certificate validation policy, or <CODE>null</CODE>
0N/A * if the provided value is not the name of a valid policy.
0N/A */
0N/A public static CertificateValidationPolicy policyForName(String policyName)
0N/A {
0N/A String lowerName = policyName.toLowerCase();
0N/A if (lowerName.equals("always"))
0N/A {
0N/A return CertificateValidationPolicy.ALWAYS;
0N/A }
0N/A else if (lowerName.equals("never"))
0N/A {
0N/A return CertificateValidationPolicy.NEVER;
0N/A }
0N/A else if (lowerName.equals("ifpresent"))
0N/A {
0N/A return CertificateValidationPolicy.IFPRESENT;
0N/A }
0N/A else
0N/A {
0N/A return null;
0N/A }
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves the human-readable name for this certificate validation policy.
0N/A *
0N/A * @return The human-readable name for this certificate validation policy.
0N/A */
0N/A public String toString()
0N/A {
0N/A return policyName;
0N/A }
0N/A}
0N/A