001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved 005 * 006 * The contents of this file are subject to the terms 007 * of the Common Development and Distribution License 008 * (the License). You may not use this file except in 009 * compliance with the License. 010 * 011 * You can obtain a copy of the License at 012 * https://opensso.dev.java.net/public/CDDLv1.0.html or 013 * opensso/legal/CDDLv1.0.txt 014 * See the License for the specific language governing 015 * permission and limitations under the License. 016 * 017 * When distributing Covered Code, include this CDDL 018 * Header Notice in each file and include the License file 019 * at opensso/legal/CDDLv1.0.txt. 020 * If applicable, add the following below the CDDL Header, 021 * with the fields enclosed by brackets [] replaced by 022 * your own identifying information: 023 * "Portions Copyrighted [year] [name of copyright owner]" 024 * 025 * $Id: UserNameTokenSpec.java,v 1.4 2008/08/27 19:05:53 mrudul_uchil Exp $ 026 * 027 */ 028 029package com.sun.identity.wss.security; 030 031 032 033/** 034 * This class defines the specification for generating the Username security 035 * tokens. 036 * It implements <code>SecurityTokenSpec</code> interface. 037 * 038 * @supported.all.api 039 */ 040public class UserNameTokenSpec implements SecurityTokenSpec { 041 042 private boolean isTimeStamp = false; 043 private boolean isNonce = false; 044 private String passwordType = null; 045 private String password = null; 046 private String username = null; 047 048 //Default constructor. 049 public UserNameTokenSpec() { } 050 051 /** 052 * Returns the password type. 053 * @return the password type. 054 */ 055 public String getPasswordType() { 056 return passwordType; 057 } 058 059 /** 060 * Sets the password type. 061 * @param passwordType the password type. 062 */ 063 public void setPasswordType(String passwordType) { 064 this.passwordType = passwordType; 065 } 066 067 /** 068 * Sets if the nonce should be used. 069 * @param isNonce true if the nonce should be used. 070 */ 071 public void setNonce(boolean isNonce) { 072 this.isNonce = isNonce; 073 } 074 075 /** 076 * Checks if the nonce should be used. 077 * @return true if the nonce should be used. 078 */ 079 public boolean isCreateNonce() { 080 return isNonce; 081 } 082 083 /** 084 * Checks if the creation time stamp should be used. 085 * @return true if the create time stamp should be used. 086 */ 087 public boolean isCreateTimeStamp() { 088 return isTimeStamp; 089 } 090 091 /** 092 * Sets if the create time stamp should be used. 093 * @param isTimeStamp true if the time stamp should be used. 094 */ 095 public void setCreateTimeStamp(boolean isTimeStamp) { 096 this.isTimeStamp = isTimeStamp; 097 } 098 099 /** 100 * Sets the username 101 * @param username the username to be used in username token. 102 */ 103 public void setUserName(String username) { 104 this.username = username; 105 } 106 107 /** 108 * Returns the username 109 * @return the user name. 110 */ 111 public String getUserName() { 112 return username; 113 } 114 115 /** 116 * Sets the user password to be used in username token. 117 * @param password the password to be used in username token. 118 */ 119 public void setPassword(String password) { 120 this.password = password; 121 } 122 123 /** 124 * Returns the password. 125 * @return the password. 126 */ 127 public String getPassword() { 128 return password; 129 } 130}