2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk features
4 * ================================================================================
5 * Copyright (C) 2021 highstreet technologies GmbH Intellectual Property.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.ccsdk.features.sdnr.wt.oauthprovider.data;
24 import com.fasterxml.jackson.annotation.JsonIgnore;
25 import java.util.HashMap;
27 import org.onap.ccsdk.features.sdnr.wt.oauthprovider.providers.OAuthProviderFactory.OAuthProvider;
29 public class OAuthProviderConfig {
32 private String clientId;
33 private String secret;
37 private OAuthProvider type;
38 private Map<String,String> roleMapping;
40 public OAuthProvider getType() {
44 public OAuthProviderConfig(String id, String url, String clientId, String secret, String scope,
48 this.clientId = clientId;
52 this.roleMapping = new HashMap<>();
56 public String toString() {
57 return "OAuthProviderConfig [host=" + url + ", clientId=" + clientId + ", secret=" + secret + ", id=" + id
58 + ", title=" + title + ", scope=" + scope + ", type=" + type + "]";
61 public void setType(OAuthProvider type) {
65 public OAuthProviderConfig() {
66 this(null, null, null, null, null, null);
69 public void setUrl(String url) {
73 public void setClientId(String clientId) {
74 this.clientId = clientId;
77 public void setSecret(String secret) {
81 public void setId(String id) {
85 public void setTitle(String title) {
89 public void setScope(String scope) {
93 public String getId() {
97 public String getUrl() {
101 public String getClientId() {
102 return this.clientId;
105 public String getSecret() {
109 public String getTitle() {
113 public String getScope() {
117 public Map<String, String> getRoleMapping() {
121 public void setRoleMapping(Map<String, String> roleMapping) {
122 this.roleMapping = roleMapping;
126 public void handleEnvironmentVars() {
127 if (Config.isEnvExpression(id)) {
128 this.id = Config.getProperty(id, null);
130 if (Config.isEnvExpression(url)) {
131 this.url = Config.getProperty(url, null);
133 if (Config.isEnvExpression(clientId)) {
134 this.clientId = Config.getProperty(clientId, null);
136 if (Config.isEnvExpression(secret)) {
137 this.secret = Config.getProperty(secret, null);
139 if (Config.isEnvExpression(scope)) {
140 this.scope = Config.getProperty(scope, null);
142 if (Config.isEnvExpression(title)) {
143 this.title = Config.getProperty(title, null);