KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > security > auth > AuthenticationStatusImpl


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 package com.sun.enterprise.security.auth;
24
25 /**
26  * This class implements an AuthenticationStatus object.
27  * @author Harish Prabandham
28  */

29
30 public class AuthenticationStatusImpl implements AuthenticationStatus {
31     private String JavaDoc realmName; // Name of the Realm
32
private String JavaDoc authMethod; // Method used for Authentication.
33
private String JavaDoc principalName; // String form of the Principal.
34
private int status; // Status
35

36     /**
37      * This constructs a new AuthenticationStatus object.
38      * @param The name of the principal
39      * @param The name of the realm that authenticated the principal
40      * @param The method used for authenticating the principal
41      * @param The status of the authentication
42      */

43     public AuthenticationStatusImpl(String JavaDoc principalName, String JavaDoc authMethod,
44                     String JavaDoc realm,
45                     int status) {
46     this.principalName = principalName;
47     this.authMethod = authMethod;
48     this.status = status;
49     this.realmName = realm;
50     }
51
52     /**
53      * This method returns the status of the authentication
54      * @return An integer value indicating the status of the authentication
55      */

56     public int getStatus() {
57     return status;
58     }
59
60     /**
61      * This method returns a byte array of zero length, since there's
62      * no continuation data needed for passphrase based authentication.
63      * @return A byte array of zero length.
64      */

65     public byte[] getContinuationData() {
66     return new byte[0];
67     }
68
69     /**
70      * This method returns a byte array of zero length, since there's
71      * no auth specific data needed for passphrase based authentication.
72      * @return A byte array of zero length.
73      */

74     public byte[] getAuthSpecificData() {
75     return new byte[0];
76     }
77
78     /**
79      * This method returns the name of realm where the authentication was
80      * performed.
81      * @return A java.lang.String representation of the realm.
82      */

83     public String JavaDoc getRealmName() {
84     return realmName;
85     }
86     
87     /**
88      * This method returns the "method" used to perform authentication
89      * @return A java.lang.String representation of the method used. In
90      * passphrase based authentication it returns the string "password".
91      */

92     public String JavaDoc getAuthMethod() {
93     return authMethod;
94     }
95
96     /**
97      * This method returns the string representation of the principal
98      * that was authenticated.
99      * @return A java.lang.String representation of the Principal.
100      */

101     public String JavaDoc getPrincipalName() {
102     return principalName;
103     }
104 }
105
Popular Tags