01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: MemoryAuthenticatedDeployer.java 3643 2007-01-12 15:29:45Z gbevin $
07: */
08: package com.uwyn.rife.authentication.elements;
09:
10: import com.uwyn.rife.authentication.credentialsmanagers.CredentialsManagerFactoryFactory;
11: import com.uwyn.rife.authentication.credentialsmanagers.MemoryUsersFactory;
12: import com.uwyn.rife.authentication.sessionmanagers.MemorySessions;
13: import com.uwyn.rife.authentication.sessionmanagers.SessionManagerFactoryFactory;
14: import com.uwyn.rife.authentication.sessionmanagers.SimpleSessionManagerFactory;
15: import com.uwyn.rife.authentication.sessionvalidators.BasicSessionValidator;
16: import com.uwyn.rife.authentication.sessionvalidators.SessionValidatorFactoryFactory;
17: import com.uwyn.rife.authentication.sessionvalidators.SimpleSessionValidatorFactory;
18: import com.uwyn.rife.engine.exceptions.EngineException;
19: import com.uwyn.rife.ioc.HierarchicalProperties;
20:
21: /**
22: * Deployer for {@link Authenticated} elements that by default sets up all the
23: * authentication managers for memory storage.
24: *
25: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
26: * @version $Revision: 3643 $
27: * @since 1.0
28: */
29: public class MemoryAuthenticatedDeployer extends
30: FactoryPropertyAuthenticatedDeployer {
31: public void deploy() throws EngineException {
32: HierarchicalProperties properties = getElementInfo()
33: .getProperties();
34: if (getElementInfo()
35: .isPropertyEmpty(
36: SessionManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS)) {
37: properties
38: .put(
39: SessionManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS,
40: SimpleSessionManagerFactory.class.getName());
41: }
42: if (getElementInfo().isPropertyEmpty(
43: SimpleSessionManagerFactory.PROPERTYNAME_MANAGER_CLASS)) {
44: properties
45: .put(
46: SimpleSessionManagerFactory.PROPERTYNAME_MANAGER_CLASS,
47: MemorySessions.class.getName());
48: }
49:
50: if (getElementInfo()
51: .isPropertyEmpty(
52: SessionValidatorFactoryFactory.PROPERTYNAME_FACTORY_CLASS)) {
53: properties
54: .put(
55: SessionValidatorFactoryFactory.PROPERTYNAME_FACTORY_CLASS,
56: SimpleSessionValidatorFactory.class
57: .getName());
58: }
59: if (getElementInfo()
60: .isPropertyEmpty(
61: SimpleSessionValidatorFactory.PROPERTYNAME_MANAGER_CLASS)) {
62: properties
63: .put(
64: SimpleSessionValidatorFactory.PROPERTYNAME_MANAGER_CLASS,
65: BasicSessionValidator.class.getName());
66: }
67:
68: if (getElementInfo()
69: .isPropertyEmpty(
70: CredentialsManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS)) {
71: properties
72: .put(
73: CredentialsManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS,
74: MemoryUsersFactory.class.getName());
75: }
76:
77: super.deploy();
78: }
79: }
|