|
7 | 7 | -module(oauth2_client). |
8 | 8 | -export([get_access_token/2, get_expiration_time/1, |
9 | 9 | refresh_access_token/2, |
| 10 | + get_jwks/2, get_jwks/3, |
10 | 11 | get_oauth_provider/1, get_oauth_provider/2, |
11 | 12 | get_openid_configuration/2,get_openid_configuration/3, |
12 | 13 | build_openid_discovery_endpoint/3, |
@@ -139,6 +140,22 @@ get_openid_configuration(DiscoverEndpoint, TLSOptions, ProxyOptions) -> |
139 | 140 | Response = http_get(DiscoverEndpoint, HTTPOptions, ProxyOptions), |
140 | 141 | parse_openid_configuration_response(Response). |
141 | 142 |
|
| 143 | +-spec get_jwks(JWKSEndpoint :: uri_string:uri_string(), |
| 144 | + ssl:tls_option() | []) -> {ok, openid_configuration()} | {error, term()}. |
| 145 | +get_jwks(JWKSEndpoint, TLSOptions) -> |
| 146 | + get_jwks(JWKSEndpoint, TLSOptions, undefined). |
| 147 | + |
| 148 | +-spec get_jwks(JWKSEndpoint :: uri_string:uri_string(), |
| 149 | + ssl:tls_option() | [], proxy_options() | undefined | 'none') |
| 150 | + -> {ok, openid_configuration()} | {error, term()}. |
| 151 | +get_jwks(JWKSEndpoint, TLSOptions, ProxyOptions) -> |
| 152 | + rabbit_log:debug("get_jwks from ~p (~p) [~p]", [JWKSEndpoint, |
| 153 | + format_ssl_options(TLSOptions), format_proxy_options(ProxyOptions)]), |
| 154 | + HTTPOptions = |
| 155 | + map_ssl_options_to_httpc_option(TLSOptions) ++ |
| 156 | + map_timeout_to_httpc_option(?DEFAULT_HTTP_TIMEOUT), |
| 157 | + http_get(JWKSEndpoint, HTTPOptions, ProxyOptions). |
| 158 | + |
142 | 159 | -spec merge_openid_configuration(openid_configuration(), oauth_provider()) -> |
143 | 160 | oauth_provider(). |
144 | 161 | merge_openid_configuration(OpenId, OAuthProvider0) -> |
|
0 commit comments