Source Code Cross Referenced for AppConfigurationEntry.java in  » 6.0-JDK-Core » security » javax » security » auth » login » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » security » javax.security.auth.login 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package javax.security.auth.login;
027
028        import java.util.Map;
029        import java.util.Collections;
030
031        /**
032         * This class represents a single <code>LoginModule</code> entry
033         * configured for the application specified in the
034         * <code>getAppConfigurationEntry(String appName)</code>
035         * method in the <code>Configuration</code> class.  Each respective
036         * <code>AppConfigurationEntry</code> contains a <code>LoginModule</code> name,
037         * a control flag (specifying whether this <code>LoginModule</code> is
038         * REQUIRED, REQUISITE, SUFFICIENT, or OPTIONAL), and LoginModule-specific
039         * options.  Please refer to the <code>Configuration</code> class for
040         * more information on the different control flags and their semantics.
041         *
042         * @version 1.43, 05/05/07
043         * @see javax.security.auth.login.Configuration
044         */
045        public class AppConfigurationEntry {
046
047            private String loginModuleName;
048            private LoginModuleControlFlag controlFlag;
049            private Map<String, ?> options;
050
051            /**
052             * Default constructor for this class.
053             *
054             * <p> This entry represents a single <code>LoginModule</code>
055             * entry configured for the application specified in the
056             * <code>getAppConfigurationEntry(String appName)</code>
057             * method from the <code>Configuration</code> class.
058             *
059             * @param loginModuleName String representing the class name of the
060             *			<code>LoginModule</code> configured for the
061             *			specified application. <p>
062             *
063             * @param controlFlag either REQUIRED, REQUISITE, SUFFICIENT,
064             *			or OPTIONAL. <p>
065             *
066             * @param options the options configured for this <code>LoginModule</code>.
067             *
068             * @exception IllegalArgumentException if <code>loginModuleName</code>
069             *			is null, if <code>LoginModuleName</code>
070             *			has a length of 0, if <code>controlFlag</code>
071             *			is not either REQUIRED, REQUISITE, SUFFICIENT
072             *			or OPTIONAL, or if <code>options</code> is null.
073             */
074            public AppConfigurationEntry(String loginModuleName,
075                    LoginModuleControlFlag controlFlag, Map<String, ?> options) {
076                if (loginModuleName == null
077                        || loginModuleName.length() == 0
078                        || (controlFlag != LoginModuleControlFlag.REQUIRED
079                                && controlFlag != LoginModuleControlFlag.REQUISITE
080                                && controlFlag != LoginModuleControlFlag.SUFFICIENT && controlFlag != LoginModuleControlFlag.OPTIONAL)
081                        || options == null)
082                    throw new IllegalArgumentException();
083
084                this .loginModuleName = loginModuleName;
085                this .controlFlag = controlFlag;
086                this .options = Collections.unmodifiableMap(options);
087            }
088
089            /**
090             * Get the class name of the configured <code>LoginModule</code>.
091             *
092             * @return the class name of the configured <code>LoginModule</code> as
093             *		a String.
094             */
095            public String getLoginModuleName() {
096                return loginModuleName;
097            }
098
099            /**
100             * Return the controlFlag
101             * (either REQUIRED, REQUISITE, SUFFICIENT, or OPTIONAL)
102             * for this <code>LoginModule</code>.
103             *
104             * @return the controlFlag
105             *		(either REQUIRED, REQUISITE, SUFFICIENT, or OPTIONAL)
106             *		for this <code>LoginModule</code>.
107             */
108            public LoginModuleControlFlag getControlFlag() {
109                return controlFlag;
110            }
111
112            /**
113             * Get the options configured for this <code>LoginModule</code>.
114             *
115             * @return the options configured for this <code>LoginModule</code>
116             *		as an unmodifiable <code>Map</code>.
117             */
118            public Map<String, ?> getOptions() {
119                return options;
120            }
121
122            /**
123             * This class represents whether or not a <code>LoginModule</code>
124             * is REQUIRED, REQUISITE, SUFFICIENT or OPTIONAL.
125             */
126            public static class LoginModuleControlFlag {
127
128                private String controlFlag;
129
130                /**
131                 * Required <code>LoginModule</code>.
132                 */
133                public static final LoginModuleControlFlag REQUIRED = new LoginModuleControlFlag(
134                        "required");
135
136                /**
137                 * Requisite <code>LoginModule</code>.
138                 */
139                public static final LoginModuleControlFlag REQUISITE = new LoginModuleControlFlag(
140                        "requisite");
141
142                /**
143                 * Sufficient <code>LoginModule</code>.
144                 */
145                public static final LoginModuleControlFlag SUFFICIENT = new LoginModuleControlFlag(
146                        "sufficient");
147
148                /**
149                 * Optional <code>LoginModule</code>.
150                 */
151                public static final LoginModuleControlFlag OPTIONAL = new LoginModuleControlFlag(
152                        "optional");
153
154                private LoginModuleControlFlag(String controlFlag) {
155                    this .controlFlag = controlFlag;
156                }
157
158                /**
159                 * Return a String representation of this controlFlag.
160                 *
161                 * <p> The String has the format, "LoginModuleControlFlag: <i>flag</i>",
162                 * where <i>flag</i> is either <i>required</i>, <i>requisite</i>,
163                 * <i>sufficient</i>, or <i>optional</i>.
164                 *
165                 * @return a String representation of this controlFlag.
166                 */
167                public String toString() {
168                    return (sun.security.util.ResourcesMgr
169                            .getString("LoginModuleControlFlag: ") + controlFlag);
170                }
171            }
172        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.