adding algorithm debug statments. fixing / improving build
[Bookkeeping.git] / src / com / interrupt / bookkeeping / cc / bkell / aauth / AuthenticateUserVisitor.java
blobdf070a42e188101ded48646a1938602cdb8d53ce
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) {
21 uname = un;
23 public String getUname() {
24 return uname;
26 public void setPasswd(String pwd) {
27 passwd = pwd;
29 public String getPasswd() {
30 return passwd;
32 public UserSession getUserSession() {
33 return this.usession;
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());