001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Portions Copyright 2011-2015 ForgeRock AS. 025 */ 026 027package org.opends.server.api; 028 029 030 031import java.util.List; 032 033import org.forgerock.i18n.LocalizableMessage; 034import org.opends.server.admin.std.server.AuthenticationPolicyCfg; 035import org.forgerock.opendj.config.server.ConfigException; 036import org.opends.server.core.ServerContext; 037import org.opends.server.types.InitializationException; 038 039 040 041/** 042 * A factory for creating configurable authentication policies. 043 * <p> 044 * All implementations must have a default constructor, i.e. one that does not 045 * require and arguments. 046 * 047 * @param <T> 048 * The type of authentication policy configuration handled by this 049 * factory. 050 */ 051public interface AuthenticationPolicyFactory<T extends AuthenticationPolicyCfg> 052{ 053 /** 054 * Creates a new authentication policy using the provided configuration. 055 * 056 * @param configuration 057 * The configuration. 058 * @return The new authentication policy configured using the provided 059 * configuration. 060 * @throws ConfigException 061 * If an unrecoverable problem arises during initialization of the 062 * authentication policy as a result of the server configuration. 063 * @throws InitializationException 064 * If a problem occurs during initialization of the authentication 065 * policy. 066 */ 067 AuthenticationPolicy createAuthenticationPolicy(T configuration) 068 throws ConfigException, InitializationException; 069 070 071 072 /** 073 * Indicates whether the provided authentication policy configuration is 074 * acceptable. 075 * 076 * @param configuration 077 * The authentication policy configuration. 078 * @param unacceptableReasons 079 * A list that can be used to hold messages about why the provided 080 * configuration is not acceptable. 081 * @return Returns <code>true</code> if the provided authentication policy 082 * configuration is acceptable, or <code>false</code> if it is not. 083 */ 084 boolean isConfigurationAcceptable(T configuration, 085 List<LocalizableMessage> unacceptableReasons); 086 087 088 /** 089 * Sets the server context. 090 * 091 * @param serverContext 092 * The server context. 093 */ 094 void setServerContext(ServerContext serverContext); 095 096}