001/* 002 * (C) Copyright 2015 Nuxeo SA (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-2.1.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 * Nelson Silva 016 */ 017package org.nuxeo.ecm.platform.oauth2.providers; 018 019import org.nuxeo.common.xmap.annotation.XNode; 020import org.nuxeo.common.xmap.annotation.XNodeList; 021import org.nuxeo.common.xmap.annotation.XObject; 022 023import java.io.Serializable; 024 025/** 026 * @since 7.3 027 */ 028@XObject("provider") 029public class OAuth2ServiceProviderDescriptor implements Serializable { 030 protected static final long serialVersionUID = 1L; 031 032 public static final String DEFAULT_ACCESS_TOKEN_KEY = "access_token"; 033 034 public static final Class<? extends OAuth2ServiceProvider> DEFAULT_PROVIDER_CLASS = NuxeoOAuth2ServiceProvider.class; 035 036 @XNode("@enabled") 037 protected boolean enabled = true; 038 039 @XNode("name") 040 protected String name; 041 042 @XNode("tokenServerURL") 043 protected String tokenServerURL; 044 045 @XNode("authorizationServerURL") 046 protected String authorizationServerURL; 047 048 @XNode("userInfoURL") 049 protected String userInfoURL; 050 051 @XNode("accessTokenKey") 052 protected String accessTokenKey = DEFAULT_ACCESS_TOKEN_KEY; 053 054 @XNode("clientId") 055 protected String clientId; 056 057 @XNode("clientSecret") 058 protected String clientSecret; 059 060 @XNodeList(value = "scope", type = String[].class, componentType = String.class) 061 protected String[] scopes; 062 063 @XNode("icon") 064 protected String icon; 065 066 @XNode("label") 067 protected String label; 068 069 @XNode("description") 070 protected String description; 071 072 @XNode("class") 073 protected Class<? extends OAuth2ServiceProvider> providerClass = DEFAULT_PROVIDER_CLASS; 074 075 public static long getSerialversionuid() { 076 return serialVersionUID; 077 } 078 079 public String getName() { 080 return name; 081 } 082 083 public String getTokenServerURL() { 084 return tokenServerURL; 085 } 086 087 public String getAuthorizationServerURL() { 088 return authorizationServerURL; 089 } 090 091 public String getClientId() { 092 return clientId; 093 } 094 095 public String getClientSecret() { 096 return clientSecret; 097 } 098 099 public String[] getScopes() { 100 return scopes; 101 } 102 103 public String getIcon() { 104 return icon; 105 } 106 107 public boolean isEnabled() { 108 return enabled; 109 } 110 111 public void setEnabled(boolean enabled) { 112 this.enabled = enabled; 113 } 114 115 public String getLabel() { 116 return label; 117 } 118 119 public String getDescription() { 120 return description; 121 } 122 123 public Class<? extends OAuth2ServiceProvider> getProviderClass() { 124 return providerClass; 125 } 126}