/* * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Contributors: * Nelson Silva */ package org.nuxeo.ecm.platform.oauth2.providers; import org.nuxeo.common.xmap.annotation.XNode; import org.nuxeo.common.xmap.annotation.XNodeList; import org.nuxeo.common.xmap.annotation.XObject; import java.io.Serializable; /** * @since 7.3 */ @XObject("provider") public class OAuth2ServiceProviderDescriptor implements Serializable { protected static final long serialVersionUID = 1L; public static final String DEFAULT_ACCESS_TOKEN_KEY = "access_token"; public static final Class<? extends OAuth2ServiceProvider> DEFAULT_PROVIDER_CLASS = NuxeoOAuth2ServiceProvider.class; @XNode("@enabled") protected boolean enabled = true; @XNode("name") protected String name; @XNode("tokenServerURL") protected String tokenServerURL; @XNode("authorizationServerURL") protected String authorizationServerURL; @XNode("userInfoURL") protected String userInfoURL; @XNode("accessTokenKey") protected String accessTokenKey = DEFAULT_ACCESS_TOKEN_KEY; @XNode("clientId") protected String clientId; @XNode("clientSecret") protected String clientSecret; @XNodeList(value = "scope", type = String[].class, componentType = String.class) protected String[] scopes; @XNode("icon") protected String icon; @XNode("label") protected String label; @XNode("description") protected String description; @XNode("class") protected Class<? extends OAuth2ServiceProvider> providerClass = DEFAULT_PROVIDER_CLASS; public static long getSerialversionuid() { return serialVersionUID; } public String getName() { return name; } public String getTokenServerURL() { return tokenServerURL; } public String getAuthorizationServerURL() { return authorizationServerURL; } public String getClientId() { return clientId; } public String getClientSecret() { return clientSecret; } public String[] getScopes() { return scopes; } public String getIcon() { return icon; } public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getLabel() { return label; } public String getDescription() { return description; } public Class<? extends OAuth2ServiceProvider> getProviderClass() { return providerClass; } }