1 package com
.interrupt
.bookkeeping
.cc
.bkell
.aauth
;
3 import org
.apache
.log4j
.Logger
;
5 import com
.interrupt
.bob
.base
.BobSystem
;
7 import com
.interrupt
.bob
.base
.IBob
;
8 import com
.interrupt
.bob
.base
.IVisitor
;
9 import com
.interrupt
.bookkeeping
.users
.User
;
10 import com
.interrupt
.bookkeeping
.users
.UserSession
;
13 public class AuthenticateUserVisitor
implements IVisitor
{
15 private String uname
= null;
16 private String passwd
= null;
17 private Logger logger
= Logger
.getLogger(AuthenticateUserVisitor
.class);
18 private UserSession usession
= null;
20 public void setUname(String un
) {
23 public String
getUname() {
26 public void setPasswd(String pwd
) {
29 public String
getPasswd() {
32 public UserSession
getUserSession() {
35 public void setUserSession(UserSession usession
) {
36 this.usession
= usession
;
38 public void visit(IBob bob
) {
40 logger
.debug("AuthenticateUserVisitor::visit > tagName["+ bob
.getTagName() +"] > id["+ bob
.getAttributeValue("id") +"]");
41 if( bob
.getTagName().equals("user") ) {
43 if( ((User
)bob
).getUsername().equals(uname
) &&
44 ((User
)bob
).getPassword().equals(passwd
) ) {
46 ((User
)bob
).setAuthenticated(true);
47 ((User
)bob
).setUserSession(usession
);
48 ((User
)bob
).startSession();
52 if( bob
.getTagName().equals("user") ) {
53 logger
.debug(">>>>> Visiting \\ "+ bob
.getTagName() +" \\ authenticated \\ "+ ((User
)bob
).isAuthenticated());