001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 */
017
018package org.nuxeo.ecm.platform.ui.web.auth.service;
019
020import java.io.Serializable;
021import java.util.HashMap;
022import java.util.Map;
023import org.nuxeo.common.xmap.annotation.XNode;
024import org.nuxeo.common.xmap.annotation.XNodeMap;
025import org.nuxeo.common.xmap.annotation.XObject;
026import org.nuxeo.ecm.platform.ui.web.auth.interfaces.NuxeoAuthenticationPlugin;
027
028@XObject("authenticationPlugin")
029public class AuthenticationPluginDescriptor implements Serializable {
030
031    private static final long serialVersionUID = 237654398643289764L;
032
033    @XNode("@name")
034    private String name;
035
036    @XNode("@enabled")
037    boolean enabled = true;
038
039    @XNode("@class")
040    Class<NuxeoAuthenticationPlugin> className;
041
042    @XNode("loginModulePlugin")
043    String loginModulePlugin;
044
045    private Boolean needStartingURLSaving;
046
047    @XNodeMap(value = "parameters/parameter", key = "@name", type = HashMap.class, componentType = String.class)
048    Map<String, String> parameters = new HashMap<String, String>();
049
050    private Boolean stateful;
051
052    public Class<NuxeoAuthenticationPlugin> getClassName() {
053        return className;
054    }
055
056    public boolean getEnabled() {
057        return enabled;
058    }
059
060    public void setEnabled(boolean enabled) {
061        this.enabled = enabled;
062    }
063
064    public String getLoginModulePlugin() {
065        return loginModulePlugin;
066    }
067
068    public void setLoginModulePlugin(String loginModulePlugin) {
069        this.loginModulePlugin = loginModulePlugin;
070    }
071
072    public String getName() {
073        return name;
074    }
075
076    public Map<String, String> getParameters() {
077        return parameters;
078    }
079
080    public void setParameters(Map<String, String> parameters) {
081        this.parameters = parameters;
082    }
083
084    public boolean getNeedStartingURLSaving() {
085        if (needStartingURLSaving != null) {
086            return needStartingURLSaving;
087        }
088        return false;
089    }
090
091    public boolean getStateful() {
092        if (stateful != null) {
093            return stateful;
094        }
095        return Boolean.valueOf(getNeedStartingURLSaving());
096    }
097
098    public void setClassName(Class<NuxeoAuthenticationPlugin> className) {
099        this.className = className;
100    }
101
102    @XNode("needStartingURLSaving")
103    public void setNeedStartingURLSaving(boolean needStartingURLSaving) {
104        this.needStartingURLSaving = Boolean.valueOf(needStartingURLSaving);
105    }
106
107    @XNode("stateful")
108    public void setStateful(boolean stateful) {
109        this.stateful = Boolean.valueOf(stateful);
110    }
111
112}