|
1 | 1 | /*************************************************************************** |
2 | 2 | * |
3 | | - * Copyright (C) 2018-2019 - ZmartZone Holding BV - www.zmartzone.eu |
| 3 | + * Copyright (C) 2018-2020 - ZmartZone Holding BV - www.zmartzone.eu |
4 | 4 | * |
5 | 5 | * This program is free software: you can redistribute it and/or modify |
6 | 6 | * it under the terms of the GNU Affero General Public License as |
@@ -83,10 +83,7 @@ oauth2_sts_cfg_t *oauth2_sts_cfg_create(oauth2_log_t *log, const char *path) |
83 | 83 | c->wstrust_token_type = NULL; |
84 | 84 | c->wstrust_value_type = NULL; |
85 | 85 |
|
86 | | - c->ropc_endpoint = NULL; |
87 | | - c->ropc_endpoint_auth = NULL; |
88 | | - c->ropc_client_id = NULL; |
89 | | - c->ropc_username = NULL; |
| 86 | + c->ropc = NULL; |
90 | 87 |
|
91 | 88 | c->otx_endpoint = NULL; |
92 | 89 | c->otx_endpoint_auth = NULL; |
@@ -137,17 +134,8 @@ void oauth2_sts_cfg_merge(oauth2_log_t *log, oauth2_sts_cfg_t *cfg, |
137 | 134 | oauth2_strdup(add->wstrust_value_type ? add->wstrust_value_type |
138 | 135 | : base->wstrust_value_type); |
139 | 136 |
|
140 | | - cfg->ropc_endpoint = oauth2_strdup( |
141 | | - add->ropc_endpoint ? add->ropc_endpoint : base->ropc_endpoint); |
142 | | - cfg->ropc_endpoint_auth = |
143 | | - add->ropc_endpoint_auth |
144 | | - ? oauth2_cfg_endpoint_auth_clone(NULL, add->ropc_endpoint_auth) |
145 | | - : oauth2_cfg_endpoint_auth_clone(NULL, |
146 | | - base->ropc_endpoint_auth); |
147 | | - cfg->ropc_client_id = oauth2_strdup( |
148 | | - add->ropc_client_id ? add->ropc_client_id : base->ropc_client_id); |
149 | | - cfg->ropc_username = oauth2_strdup( |
150 | | - add->ropc_username ? add->ropc_username : base->ropc_username); |
| 137 | + cfg->ropc = add->ropc ? oauth2_cfg_ropc_clone(NULL, add->ropc) |
| 138 | + : oauth2_cfg_ropc_clone(NULL, base->ropc); |
151 | 139 |
|
152 | 140 | cfg->otx_endpoint = oauth2_strdup( |
153 | 141 | add->otx_endpoint ? add->otx_endpoint : base->otx_endpoint); |
@@ -229,15 +217,8 @@ void oauth2_sts_cfg_free(oauth2_log_t *log, oauth2_sts_cfg_t *cfg) |
229 | 217 | if (cfg->wstrust_value_type) |
230 | 218 | oauth2_mem_free(cfg->wstrust_value_type); |
231 | 219 |
|
232 | | - if (cfg->ropc_endpoint) |
233 | | - oauth2_mem_free(cfg->ropc_endpoint); |
234 | | - if (cfg->ropc_endpoint_auth) |
235 | | - oauth2_cfg_endpoint_auth_free(cfg->log, |
236 | | - cfg->ropc_endpoint_auth); |
237 | | - if (cfg->ropc_client_id) |
238 | | - oauth2_mem_free(cfg->ropc_client_id); |
239 | | - if (cfg->ropc_username) |
240 | | - oauth2_mem_free(cfg->ropc_username); |
| 220 | + if (cfg->ropc) |
| 221 | + oauth2_cfg_ropc_free(cfg->log, cfg->ropc); |
241 | 222 |
|
242 | 223 | if (cfg->otx_endpoint) |
243 | 224 | oauth2_mem_free(cfg->otx_endpoint); |
@@ -285,9 +266,9 @@ STS_CFG_SET_TAKE1_IMPL(wstrust_endpoint, str) |
285 | 266 | STS_CFG_SET_TAKE1_IMPL(wstrust_applies_to, str) |
286 | 267 | STS_CFG_SET_TAKE1_IMPL(wstrust_token_type, str) |
287 | 268 | STS_CFG_SET_TAKE1_IMPL(wstrust_value_type, str) |
288 | | -STS_CFG_SET_TAKE1_IMPL(ropc_endpoint, str) |
289 | | -STS_CFG_SET_TAKE1_IMPL(ropc_client_id, str) |
290 | | -STS_CFG_SET_TAKE1_IMPL(ropc_username, str) |
| 269 | +// STS_CFG_SET_TAKE1_IMPL(ropc_endpoint, str) |
| 270 | +// STS_CFG_SET_TAKE1_IMPL(ropc_client_id, str) |
| 271 | +// STS_CFG_SET_TAKE1_IMPL(ropc_username, str) |
291 | 272 | STS_CFG_SET_TAKE1_IMPL(otx_endpoint, str) |
292 | 273 | STS_CFG_SET_TAKE1_IMPL(otx_client_id, str) |
293 | 274 | STS_CFG_SET_TAKE1_IMPL(cache_expiry_s, uint) |
@@ -378,11 +359,11 @@ const char *sts_cfg_set_wstrust_endpoint_auth(oauth2_sts_cfg_t *cfg, |
378 | 359 | return rv; |
379 | 360 | } |
380 | 361 |
|
381 | | -const char *sts_cfg_set_ropc_endpoint_auth(oauth2_sts_cfg_t *cfg, |
382 | | - const char *type, const char *value) |
| 362 | +const char *sts_cfg_set_ropc(oauth2_sts_cfg_t *cfg, const char *value) |
383 | 363 | { |
384 | | - return _sts_cfg_set_endpoint_auth(&cfg->ropc_endpoint_auth, type, |
385 | | - value); |
| 364 | + if (cfg->ropc == NULL) |
| 365 | + cfg->ropc = oauth2_cfg_ropc_init(cfg->log); |
| 366 | + return oauth2_cfg_set_ropc_options(cfg->log, cfg->ropc, value); |
386 | 367 | } |
387 | 368 |
|
388 | 369 | const char *sts_cfg_set_otx_endpoint_auth(oauth2_sts_cfg_t *cfg, |
|
0 commit comments