我正在实现一个OIDC客户端,我想从该网页读取其余端点。
https://login.bbmri-eric.eu/oidc/.well-known/openid-configuration
例如我的应用程序应该具有密钥authorization_endpoint
,它应该从上述url中读取该密钥的值。
有没有一种方法/库可以在没有太多字符串检查的情况下从这样的网页中读取内容?
答案 0 :(得分:0)
如果您在浏览器中点击https://login.bbmri-eric.eu/oidc/.well-known/openid-configuration
,则会返回一个json,如下所示。如注释中所述,您所需的只是下面的代码。
如何在Java中读取json-许多选择之一是包括Apache Commons IOUtils和json.org库(下载maven依赖项)。
JSONObject jsonObject = new JSONObject(IOUtils.toString(new URL("https://login.bbmri-eric.eu/oidc/.well-known/openid-configuration"), Charset.forName("UTF-8")));
现在,如果下面是JSON,则此jsonObject是Java表示形式。我希望您知道如何使用Java对象。如果您不阅读此guide或未查看此线程link
-您的JSON-
{
"request_parameter_supported": true,
"claims_parameter_supported": false,
"introspection_endpoint": "https://login.bbmri-eric.eu/oidc/introspect",
"scopes_supported": [
"openid",
"offline_access"
],
"issuer": "https://login.bbmri-eric.eu/oidc/",
"userinfo_encryption_enc_values_supported": [
"A256CBC+HS512",
"A256GCM",
"A192GCM",
"A128GCM",
"A128CBC-HS256",
"A192CBC-HS384",
"A256CBC-HS512",
"A128CBC+HS256"
],
"id_token_encryption_enc_values_supported": [
"A256CBC+HS512",
"A256GCM",
"A192GCM",
"A128GCM",
"A128CBC-HS256",
"A192CBC-HS384",
"A256CBC-HS512",
"A128CBC+HS256"
],
"authorization_endpoint": "https://login.bbmri-eric.eu/oidc/authorize",
"service_documentation": "https://login.bbmri-eric.eu/oidc/about",
"request_object_encryption_enc_values_supported": [
"A256CBC+HS512",
"A256GCM",
"A192GCM",
"A128GCM",
"A128CBC-HS256",
"A192CBC-HS384",
"A256CBC-HS512",
"A128CBC+HS256"
],
"device_authorization_endpoint": "https://login.bbmri-eric.eu/oidc/devicecode",
"userinfo_signing_alg_values_supported": [
"HS256",
"HS384",
"HS512",
"RS256",
"RS384",
"RS512",
"ES256",
"ES384",
"ES512",
"PS256",
"PS384",
"PS512"
],
"claims_supported": [
"sub",
"name",
"preferred_username",
"given_name",
"family_name",
"middle_name",
"nickname",
"profile",
"picture",
"website",
"gender",
"zoneinfo",
"locale",
"updated_at",
"birthdate",
"email",
"email_verified",
"phone_number",
"phone_number_verified",
"address"
],
"claim_types_supported": [
"normal"
],
"op_policy_uri": "https://login.bbmri-eric.eu/oidc/about",
"token_endpoint_auth_methods_supported": [
"client_secret_post",
"client_secret_basic",
"client_secret_jwt",
"private_key_jwt",
"none"
],
"token_endpoint": "https://login.bbmri-eric.eu/oidc/token",
"response_types_supported": [
"code",
"token"
],
"request_uri_parameter_supported": false,
"userinfo_encryption_alg_values_supported": [
"RSA-OAEP",
"RSA-OAEP-256",
"RSA1_5"
],
"grant_types_supported": [
"authorization_code",
"implicit",
"urn:ietf:params:oauth:grant-type:jwt-bearer",
"client_credentials",
"urn:ietf:params:oauth:grant_type:redelegate",
"urn:ietf:params:oauth:grant-type:device_code"
],
"end_session_endpoint": "https://login.bbmri-eric.eu/oidc/endsession",
"revocation_endpoint": "https://login.bbmri-eric.eu/oidc/revoke",
"userinfo_endpoint": "https://login.bbmri-eric.eu/oidc/userinfo",
"token_endpoint_auth_signing_alg_values_supported": [
"HS256",
"HS384",
"HS512",
"RS256",
"RS384",
"RS512",
"ES256",
"ES384",
"ES512",
"PS256",
"PS384",
"PS512"
],
"op_tos_uri": "https://login.bbmri-eric.eu/oidc/about",
"require_request_uri_registration": false,
"code_challenge_methods_supported": [
"plain",
"S256"
],
"id_token_encryption_alg_values_supported": [
"RSA-OAEP",
"RSA-OAEP-256",
"RSA1_5"
],
"jwks_uri": "https://login.bbmri-eric.eu/oidc/jwk",
"subject_types_supported": [
"public",
"pairwise"
],
"id_token_signing_alg_values_supported": [
"HS256",
"HS384",
"HS512",
"RS256",
"RS384",
"RS512",
"ES256",
"ES384",
"ES512",
"PS256",
"PS384",
"PS512",
"none"
],
"registration_endpoint": "https://login.bbmri-eric.eu/oidc/register",
"request_object_signing_alg_values_supported": [
"HS256",
"HS384",
"HS512",
"RS256",
"RS384",
"RS512",
"ES256",
"ES384",
"ES512",
"PS256",
"PS384",
"PS512"
],
"request_object_encryption_alg_values_supported": [
"RSA-OAEP",
"RSA-OAEP-256",
"RSA1_5"
]
}