001package com.hfg.security; 002 003 004//------------------------------------------------------------------------------ 005/** 006 * Simple container for a user/password. 007 * 008 * @author J. Alex Taylor, hairyfatguy.com 009 */ 010//------------------------------------------------------------------------------ 011// com.hfg XML/HTML Coding Library 012// 013// This library is free software; you can redistribute it and/or 014// modify it under the terms of the GNU Lesser General Public 015// License as published by the Free Software Foundation; either 016// version 2.1 of the License, or (at your option) any later version. 017// 018// This library is distributed in the hope that it will be useful, 019// but WITHOUT ANY WARRANTY; without even the implied warranty of 020// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 021// Lesser General Public License for more details. 022// 023// You should have received a copy of the GNU Lesser General Public 024// License along with this library; if not, write to the Free Software 025// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026// 027// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 028// jataylor@hairyfatguy.com 029//------------------------------------------------------------------------------ 030 031public class LoginCredentials 032{ 033 034 //*************************************************************************** 035 // PRIVATE FIELDS 036 //*************************************************************************** 037 038 private String mUser; 039 private char[] mPassword; 040 private String mDomain; 041 042 //*************************************************************************** 043 // CONSTRUCTORS 044 //*************************************************************************** 045 046 //--------------------------------------------------------------------------- 047 public LoginCredentials(String inUser, char[] inPassword) 048 { 049 mUser = inUser; 050 mPassword = inPassword; 051 } 052 053 //*************************************************************************** 054 // PUBLIC METHODS 055 //*************************************************************************** 056 057 //--------------------------------------------------------------------------- 058 public void setUser(String inValue) 059 { 060 mUser = inValue; 061 } 062 063 //--------------------------------------------------------------------------- 064 public String getUser() 065 { 066 return mUser; 067 } 068 069 //--------------------------------------------------------------------------- 070 public char[] getPassword() 071 { 072 return mPassword; 073 } 074 075 //--------------------------------------------------------------------------- 076 public String getPasswordString() 077 { 078 return new String(mPassword); 079 } 080 081 082 //--------------------------------------------------------------------------- 083 public LoginCredentials setDomain(String inValue) 084 { 085 mDomain = inValue; 086 return this; 087 } 088 089 //--------------------------------------------------------------------------- 090 public String getDomain() 091 { 092 if (null == mDomain 093 && mUser.indexOf("@") > 0) 094 { 095 mDomain = mUser.substring(mUser.indexOf("@") + 1); 096 } 097 098 return mDomain; 099 } 100 101}