1 17 package org.alfresco.filesys.server.auth.ntlm; 18 19 import java.util.Date ; 20 21 import net.sf.acegisecurity.Authentication; 22 23 30 public class NTLMLogonDetails 31 { 32 34 private String m_user; 35 private String m_workstation; 36 private String m_domain; 37 38 40 private String m_authSrvAddr; 41 42 44 private long m_authTime; 45 46 48 private boolean m_guestAccess; 49 50 52 private Type2NTLMMessage m_type2Msg; 53 private byte[] m_ntlmHash; 54 55 57 private Authentication m_authToken; 58 59 62 public NTLMLogonDetails() 63 { 64 } 65 66 75 public NTLMLogonDetails(String user, String wks, String domain, boolean guest, String authSrv) 76 { 77 setDetails(user, wks, domain, guest, authSrv); 78 } 79 80 85 public final String getUserName() 86 { 87 return m_user; 88 } 89 90 95 public final String getWorkstation() 96 { 97 return m_workstation; 98 } 99 100 105 public final String getDomain() 106 { 107 return m_domain; 108 } 109 110 115 public final String getAuthenticationServer() 116 { 117 return m_authSrvAddr; 118 } 119 120 125 public final long authenticatedAt() 126 { 127 return m_authTime; 128 } 129 130 135 public final boolean hasType2Message() 136 { 137 return m_type2Msg != null ? true : false; 138 } 139 140 145 public final Type2NTLMMessage getType2Message() 146 { 147 return m_type2Msg; 148 } 149 150 155 public final boolean hasNTLMHashedPassword() 156 { 157 return m_ntlmHash != null ? true : false; 158 } 159 160 165 public final byte[] getNTLMHashedPassword() 166 { 167 return m_ntlmHash; 168 } 169 170 175 public final byte[] getChallengeKey() 176 { 177 if ( m_type2Msg != null) 178 return m_type2Msg.getChallenge(); 179 return null; 180 } 181 182 187 public final boolean hasAuthenticationToken() 188 { 189 return m_authToken != null ? true : false; 190 } 191 192 197 public final Authentication getAuthenticationToken() 198 { 199 return m_authToken; 200 } 201 202 207 public final void setAuthenticatedAt(long authTime) 208 { 209 m_authTime = authTime; 210 } 211 212 221 public final void setDetails(String user, String wks, String domain, boolean guest, String authSrv) 222 { 223 m_user = user; 224 m_workstation = wks; 225 m_domain = domain; 226 227 m_authSrvAddr = authSrv; 228 229 m_guestAccess = guest; 230 231 m_authTime = System.currentTimeMillis(); 232 } 233 234 239 public final void setType2Message(Type2NTLMMessage type2) 240 { 241 m_type2Msg = type2; 242 } 243 244 249 public final void setNTLMHashedPassword(byte[] ntlmHash) 250 { 251 m_ntlmHash = ntlmHash; 252 } 253 254 259 public final void setAuthenticationToken(Authentication token) 260 { 261 m_authToken = token; 262 } 263 264 269 public String toString() 270 { 271 StringBuilder str = new StringBuilder (); 272 273 str.append("["); 274 str.append(getUserName()); 275 str.append(",Wks:"); 276 str.append(getWorkstation()); 277 str.append(",Dom:"); 278 str.append(getDomain()); 279 str.append(",AuthSrv:"); 280 str.append(getAuthenticationServer()); 281 str.append(","); 282 str.append(new Date (authenticatedAt())); 283 284 if ( hasAuthenticationToken()) 285 { 286 str.append(",token="); 287 str.append(getAuthenticationToken()); 288 } 289 290 str.append("]"); 291 292 return str.toString(); 293 } 294 } 295 | Popular Tags |