Source Code Cross Referenced for AuthorizeCallback.java in  » 6.0-JDK-Core » security » javax » security » sasl » 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.sasl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2000-2004 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.sasl;
027
028        import javax.security.auth.callback.Callback;
029
030        /**
031         * This callback is used by <tt>SaslServer</tt> to determine whether
032         * one entity (identified by an authenticated authentication id) 
033         * can act on
034         * behalf of another entity (identified by an authorization id).
035         *
036         * @since 1.5
037         *
038         * @author Rosanna Lee
039         * @author Rob Weltman
040         */
041        public class AuthorizeCallback implements  Callback,
042                java.io.Serializable {
043            /**
044             * The (authenticated) authentication id to check.
045             * @serial
046             */
047            private String authenticationID;
048
049            /**
050             * The authorization id to check.
051             * @serial
052             */
053            private String authorizationID;
054
055            /**
056             * The id of the authorized entity. If null, the id of
057             * the authorized entity is authorizationID.
058             * @serial
059             */
060            private String authorizedID;
061
062            /**
063             * A flag indicating whether the authentication id is allowed to
064             * act on behalf of the authorization id. 
065             * @serial
066             */
067            private boolean authorized;
068
069            /**
070             * Constructs an instance of <tt>AuthorizeCallback</tt>.
071             *
072             * @param authnID	The (authenticated) authentication id.
073             * @param authzID   The authorization id.
074             */
075            public AuthorizeCallback(String authnID, String authzID) {
076                authenticationID = authnID;
077                authorizationID = authzID;
078            }
079
080            /**
081             * Returns the authentication id to check.
082             * @return The authentication id to check.
083             */
084            public String getAuthenticationID() {
085                return authenticationID;
086            }
087
088            /**
089             * Returns the authorization id to check.
090             * @return The authentication id to check.
091             */
092            public String getAuthorizationID() {
093                return authorizationID;
094            }
095
096            /**
097             * Determines whether the authentication id is allowed to
098             * act on behalf of the authorization id.
099             *
100             * @return <tt>true</tt> if authorization is allowed; <tt>false</tt> otherwise
101             * @see #setAuthorized(boolean)
102             * @see #getAuthorizedID()
103             */
104            public boolean isAuthorized() {
105                return authorized;
106            }
107
108            /**
109             * Sets whether the authorization is allowed.
110             * @param ok <tt>true</tt> if authorization is allowed; <tt>false</tt> otherwise
111             * @see #isAuthorized
112             * @see #setAuthorizedID(java.lang.String)
113             */
114            public void setAuthorized(boolean ok) {
115                authorized = ok;
116            }
117
118            /**
119             * Returns the id of the authorized user.
120             * @return The id of the authorized user. <tt>null</tt> means the
121             * authorization failed.
122             * @see #setAuthorized(boolean)
123             * @see #setAuthorizedID(java.lang.String)
124             */
125            public String getAuthorizedID() {
126                if (!authorized) {
127                    return null;
128                }
129                return (authorizedID == null) ? authorizationID : authorizedID;
130            }
131
132            /**
133             * Sets the id of the authorized entity. Called by handler only when the id
134             * is different from getAuthorizationID(). For example, the id
135             * might need to be canonicalized for the environment in which it
136             * will be used.
137             * @param id The id of the authorized user.
138             * @see #setAuthorized(boolean)
139             * @see #getAuthorizedID
140             */
141            public void setAuthorizedID(String id) {
142                authorizedID = id;
143            }
144
145            private static final long serialVersionUID = -2353344186490470805L;
146        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.