8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: AuthenticationServiceNameProviderImpl.java,v 1.3 2008/06/25 05:44:03 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.authentication.util.ISAuthConstants;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.security.AdminTokenAction;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * A concrete implementation of <code>AuthenticationServiceNameProvider</code>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * that uses the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>com.sun.identity.authentication.config.AMAuthenticationManager</code>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * to retrieve the names of authentication module services that are loaded by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class AuthenticationServiceNameProviderImpl implements
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static HashSet authNmodules = new HashSet();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Provides a collection of authentication module service names that are
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * loaded by default. This implementation uses the authentication
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * service specific configuration to retrieve the relevant
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * module service name information.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return a <code>Set</code> of authentication module service names.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SSOToken token = (SSOToken) AccessController.doPrivileged(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ServiceSchemaManager scm = new ServiceSchemaManager(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Set authenticators = (Set) schema.getAttributeDefaults().get(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (Iterator it = authenticators.iterator(); it.hasNext();) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String serviceName = "iPlanetAMAuth" + module + "Service";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check if the service name exisits with organization schema
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ServiceSchemaManager ssm = new ServiceSchemaManager(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Try with "sunAMAuth"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster serviceName = "sunAMAuth" + module + "Service";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ServiceSchemaManager ssm = new ServiceSchemaManager(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Ignore the Exception and donot add to authmodules
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // 1) Service does not exisit
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // 2) OrganizationSchema does not exisit
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.error("AuthenticationServiceNameProviderImpl error", ex);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.error("AuthenticationServiceNameProviderImpl error", ex);