001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 */
019
020package org.nuxeo.ecm.platform.ui.web.auth.service;
021
022import java.io.Serializable;
023import java.util.HashMap;
024import java.util.Map;
025import org.nuxeo.common.xmap.annotation.XNode;
026import org.nuxeo.common.xmap.annotation.XNodeMap;
027import org.nuxeo.common.xmap.annotation.XObject;
028import org.nuxeo.ecm.platform.ui.web.auth.interfaces.NuxeoAuthenticationPlugin;
029
030@XObject("authenticationPlugin")
031public class AuthenticationPluginDescriptor implements Serializable {
032
033    private static final long serialVersionUID = 237654398643289764L;
034
035    @XNode("@name")
036    private String name;
037
038    @XNode("@enabled")
039    boolean enabled = true;
040
041    @XNode("@class")
042    Class<NuxeoAuthenticationPlugin> className;
043
044    @XNode("loginModulePlugin")
045    String loginModulePlugin;
046
047    private Boolean needStartingURLSaving;
048
049    @XNodeMap(value = "parameters/parameter", key = "@name", type = HashMap.class, componentType = String.class)
050    Map<String, String> parameters = new HashMap<String, String>();
051
052    private Boolean stateful;
053
054    public Class<NuxeoAuthenticationPlugin> getClassName() {
055        return className;
056    }
057
058    public boolean getEnabled() {
059        return enabled;
060    }
061
062    public void setEnabled(boolean enabled) {
063        this.enabled = enabled;
064    }
065
066    public String getLoginModulePlugin() {
067        return loginModulePlugin;
068    }
069
070    public void setLoginModulePlugin(String loginModulePlugin) {
071        this.loginModulePlugin = loginModulePlugin;
072    }
073
074    public String getName() {
075        return name;
076    }
077
078    public Map<String, String> getParameters() {
079        return parameters;
080    }
081
082    public void setParameters(Map<String, String> parameters) {
083        this.parameters = parameters;
084    }
085
086    public boolean getNeedStartingURLSaving() {
087        if (needStartingURLSaving != null) {
088            return needStartingURLSaving;
089        }
090        return false;
091    }
092
093    public boolean getStateful() {
094        if (stateful != null) {
095            return stateful;
096        }
097        return Boolean.valueOf(getNeedStartingURLSaving());
098    }
099
100    public void setClassName(Class<NuxeoAuthenticationPlugin> className) {
101        this.className = className;
102    }
103
104    @XNode("needStartingURLSaving")
105    public void setNeedStartingURLSaving(boolean needStartingURLSaving) {
106        this.needStartingURLSaving = Boolean.valueOf(needStartingURLSaving);
107    }
108
109    @XNode("stateful")
110    public void setStateful(boolean stateful) {
111        this.stateful = Boolean.valueOf(stateful);
112    }
113
114}