01: /******************************************************************************
02: * SignMeUp.java
03: * ****************************************************************************/package org.openlaszlo.test.xmlrpc;
04:
05: //import org.openlaszlo.data.LZXMLRPC;
06: import java.io.*;
07: import java.net.*;
08: import java.util.*;
09: import javax.servlet.*;
10: import javax.servlet.http.*;
11: import org.apache.log4j.*;
12:
13: public class SignMeUp {
14: private static Logger mLogger = Logger.getLogger(SignMeUp.class);
15:
16: private String mAlias = "SignMeUp";
17:
18: public String[] getUniqueUsername(String username, String first,
19: String last, HttpServletRequest req, HttpServletResponse res) {
20: mLogger.debug("getUniqueUsername");
21: String[] names = { "one", "two", "three", "four", "five", "six" };
22: return names;
23: }
24:
25: public int register(String username, String password, String name,
26: String occupation, String email, HttpServletRequest req,
27: HttpServletResponse res) {
28: mLogger.debug("register");
29: req.getSession().setAttribute("sessioned", "true");
30: return 1;
31: }
32:
33: public boolean isEmailRegistered(String email,
34: HttpServletRequest req, HttpServletResponse res) {
35: mLogger.debug("isEmailRegistered");
36: return ("one@foo.com".equals(email));
37: }
38:
39: public boolean isSessioned(HttpServletRequest req,
40: HttpServletResponse res) {
41: return "true"
42: .equals(req.getSession().getAttribute("sessioned"));
43: }
44:
45: public boolean logout(HttpServletRequest req,
46: HttpServletResponse res) throws IllegalStateException {
47: req.getSession().invalidate();
48: return true;
49: }
50:
51: public boolean login(String username, String password,
52: HttpServletRequest req, HttpServletResponse res) {
53: mLogger.debug("login");
54: boolean ok = ("fluffy".equals(username) && "pass1"
55: .equals(password));
56: if (ok) {
57: req.getSession().setAttribute("sessioned", "true");
58: }
59: return ok;
60: }
61:
62: public boolean getUsernamePassword(String email,
63: HttpServletRequest req, HttpServletResponse res) {
64: mLogger.debug("getUsernamePassword");
65: return false;
66: }
67:
68: public void initialize(Properties prop) {
69: mLogger.debug("initialize");
70: }
71: }
|