01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 2004 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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 6059 2005-01-07 13:30:11Z joaninh $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.security.ws;
25:
26: import org.objectweb.jonas.common.Log;
27: import org.objectweb.jonas.security.AbsSecurityContextHelper;
28: import org.objectweb.util.monolog.api.Logger;
29:
30: /**
31: * This class is used by Csiv2 server interceptor and by the JOnAS EJB provider Web Service.
32: * It allows to authenticate users.
33: * @author Florent Benoit : Initial developper
34: * @author Helene Joanin : Refactoring
35: */
36: public class SecurityContextHelper extends AbsSecurityContextHelper {
37:
38: /**
39: * The singleton instance
40: */
41: private static SecurityContextHelper instance = null;
42:
43: /**
44: * WS Realm key
45: */
46: private static final String WS_REALM_KEY = "jonas.service.security.ws.realm";
47:
48: /**
49: * Default ws resource name
50: */
51: private static final String DEFAULT_WS_REALM = "memrlm_1";
52:
53: /**
54: * Logger
55: */
56: private static Logger logger = Log
57: .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 getRealmKey() {
86: return WS_REALM_KEY;
87: }
88:
89: /**
90: * @return return the CSIV2 default Realm
91: */
92: protected String getRealmDefault() {
93: return DEFAULT_WS_REALM;
94: }
95:
96: }
|