KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > connectors > ConnectorSecurityAdminServiceImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.connectors;
25
26 import java.util.*;
27 import com.sun.enterprise.connectors.authentication.*;
28 import com.sun.enterprise.connectors.util.*;
29 import com.sun.enterprise.deployment.*;
30 import com.sun.enterprise.config.serverbeans.*;
31
32 /**
33  * This is Security administration service. Performs funtionality of
34  * security map creation, deletion.
35  * @author Srikanth P
36  */

37
38
39 public class ConnectorSecurityAdminServiceImpl extends
40          ConnectorServiceImpl implements ConnectorAdminService {
41
42     /**
43      * Default constructor
44      */

45
46      public ConnectorSecurityAdminServiceImpl() {
47          super();
48      }
49
50      
51     /**
52      * Obtain the authentication service associated with rar module.
53      * Currently only the BasicPassword authentication is supported.
54      * @rarName Rar module Name
55      * @poolName Name of the pool. Used for creation of
56      * BasicPasswordAuthenticationService
57      */

58
59     public AuthenticationService getAuthenticationService(String JavaDoc rarName,
60                            String JavaDoc poolName) {
61
62         ConnectorDescriptor cd = _registry.getDescriptor(rarName);
63         OutboundResourceAdapter obra = cd.getOutboundResourceAdapter();
64         Set authMechs = obra.getAuthMechanisms();
65         Iterator it = authMechs.iterator();
66         while(it.hasNext()) {
67             AuthMechanism authMechanism = (AuthMechanism)it.next();
68             String JavaDoc mech = authMechanism.getAuthMechType();
69             if(mech.equals("BasicPassword")) {
70                 return new BasicPasswordAuthenticationService(rarName,poolName);
71             }
72         }
73         return null;
74     }
75 }
76
Popular Tags