KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > security > ws > SecurityContextHelper


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: SecurityContextHelper.java,v 1.1 2005/01/07 13:30:11 joaninh Exp $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.jonas.security.ws;
26
27 import org.objectweb.jonas.common.Log;
28 import org.objectweb.jonas.security.AbsSecurityContextHelper;
29 import org.objectweb.util.monolog.api.Logger;
30
31 /**
32  * This class is used by Csiv2 server interceptor and by the JOnAS EJB provider Web Service.
33  * It allows to authenticate users.
34  * @author Florent Benoit : Initial developper
35  * @author Helene Joanin : Refactoring
36  */

37 public class SecurityContextHelper extends AbsSecurityContextHelper {
38
39     /**
40      * The singleton instance
41      */

42     private static SecurityContextHelper instance = null;
43
44     /**
45      * WS Realm key
46      */

47     private static final String JavaDoc WS_REALM_KEY = "jonas.service.security.ws.realm";
48
49     /**
50      * Default ws resource name
51      */

52     private static final String JavaDoc DEFAULT_WS_REALM = "memrlm_1";
53
54     /**
55      * Logger
56      */

57     private static Logger logger = Log.getLogger(Log.JONAS_WS_SECURITY_PREFIX);
58
59     /**
60      * Private constructor because of singleton
61      */

62     private SecurityContextHelper() {
63     }
64     
65     /**
66      * @return return the singleton instance
67      */

68     public static SecurityContextHelper getInstance() {
69         if (instance == null) {
70             instance = new SecurityContextHelper();
71         }
72         return instance;
73     }
74     
75     /**
76      * @return the associated logger
77      */

78     protected Logger getLogger() {
79         return logger;
80     }
81     
82     /**
83      * @return return the CSIV2 Realm key
84      */

85     protected String JavaDoc getRealmKey() {
86         return WS_REALM_KEY;
87     }
88     
89     /**
90      * @return return the CSIV2 default Realm
91      */

92     protected String JavaDoc getRealmDefault() {
93         return DEFAULT_WS_REALM;
94     }
95
96 }
97
Popular Tags