01: /*
02: * $Id: UsernameCallback.java,v 1.3 2006/09/29 12:04:52 kumarjayanti Exp $
03: */
04:
05: /*
06: * The contents of this file are subject to the terms
07: * of the Common Development and Distribution License
08: * (the License). You may not use this file except in
09: * compliance with the License.
10: *
11: * You can obtain a copy of the license at
12: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
13: * See the License for the specific language governing
14: * permissions and limitations under the License.
15: *
16: * When distributing Covered Code, include this CDDL
17: * Header Notice in each file and include the License file
18: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
19: * If applicable, add the following below the CDDL Header,
20: * with the fields enclosed by brackets [] replaced by
21: * you own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
25: */
26: package com.sun.xml.wss.impl.callback;
27:
28: import com.sun.xml.wss.impl.MessageConstants;
29: import javax.security.auth.callback.Callback;
30:
31: /**
32: * This Callback should be handled if the username for the username token
33: * needs to be supplied at run-time.
34: *
35: * @author XWS-Security Team
36: */
37: public class UsernameCallback extends XWSSCallback implements Callback {
38:
39: private String username;
40:
41: /**
42: * Set the Username.
43: *
44: * @param username <code>java.lang.String</code> representing the Username.
45: */
46: public void setUsername(String username) {
47: if (username == null
48: || MessageConstants._EMPTY.equals(username)) {
49: throw new RuntimeException(
50: "Username can not be empty or NULL");
51: }
52: this .username = username;
53: }
54:
55: /**
56: * Get the Username.
57: *
58: * @return <code>java.lang.String</code> representing the Username.
59: */
60: public String getUsername() {
61: return username;
62: }
63: }
|