Java
Java
OneLogin OIDC - Get Discovery Document (OpenID Connect)
See more OneLogin OIDC Examples
Downloads the OpenID Connect self-discovery document for a OneLogin OIDC enabled app.Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
boolean success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
http.put_Accept("application/json");
CkHttpResponse resp = new CkHttpResponse();
success = http.HttpNoBody("GET","https://<account>.onelogin.com/oidc/.well-known/openid-configuration",resp);
if (success == false) {
System.out.println(http.lastErrorText());
return;
}
System.out.println("Response Status Code: " + resp.get_StatusCode());
CkJsonObject jsonResponse = new CkJsonObject();
jsonResponse.Load(resp.bodyStr());
jsonResponse.put_EmitCompact(false);
System.out.println(jsonResponse.emit());
if (resp.get_StatusCode() != 200) {
System.out.println("Failed.");
return;
}
// Sample output...
// (See the parsing code below..)
//
// Use the this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
// {
// "acr_values_supported": [
// "onelogin:nist:level:1:re-auth"
// ],
// "authorization_endpoint": "https://chilkat-dev.onelogin.com/oidc/auth",
// "claims_parameter_supported": true,
// "claims_supported": [
// "acr",
// "auth_time",
// "company",
// "custom_fields",
// "department",
// "email",
// "family_name",
// "given_name",
// "groups",
// "iss",
// "locale_code",
// "name",
// "params",
// "phone_number",
// "preferred_username",
// "sid",
// "sub",
// "title",
// "updated_at"
// ],
// "grant_types_supported": [
// "authorization_code",
// "implicit",
// "refresh_token",
// "client_credentials",
// "password"
// ],
// "id_token_signing_alg_values_supported": [
// "RS256"
// ],
// "issuer": "https://openid-connect.onelogin.com/oidc",
// "jwks_uri": "https://chilkat-dev.onelogin.com/oidc/certs",
// "request_parameter_supported": false,
// "request_uri_parameter_supported": false,
// "response_modes_supported": [
// "form_post",
// "fragment",
// "query"
// ],
// "response_types_supported": [
// "code",
// "id_token token",
// "id_token"
// ],
// "scopes_supported": [
// "openid",
// "name",
// "profile",
// "groups",
// "email",
// "params",
// "phone"
// ],
// "subject_types_supported": [
// "public"
// ],
// "token_endpoint": "https://chilkat-dev.onelogin.com/oidc/token",
// "token_endpoint_auth_methods_supported": [
// "client_secret_basic",
// "client_secret_post",
// "none"
// ],
// "userinfo_endpoint": "https://chilkat-dev.onelogin.com/oidc/me",
// "userinfo_signing_alg_values_supported": [
// ],
// "code_challenge_methods_supported": [
// "S256"
// ],
// "introspection_endpoint": "https://chilkat-dev.onelogin.com/oidc/token/introspection",
// "introspection_endpoint_auth_methods_supported": [
// "client_secret_basic",
// "client_secret_post",
// "none"
// ],
// "revocation_endpoint": "https://chilkat-dev.onelogin.com/oidc/token/revocation",
// "revocation_endpoint_auth_methods_supported": [
// "client_secret_basic",
// "client_secret_post",
// "none"
// ],
// "claim_types_supported": [
// "normal"
// ]
// }
//
String authorization_endpoint;
boolean claims_parameter_supported;
String issuer;
String jwks_uri;
boolean request_parameter_supported;
boolean request_uri_parameter_supported;
String token_endpoint;
String userinfo_endpoint;
String introspection_endpoint;
String revocation_endpoint;
int i;
int count_i;
String strVal;
authorization_endpoint = jsonResponse.stringOf("authorization_endpoint");
claims_parameter_supported = jsonResponse.BoolOf("claims_parameter_supported");
issuer = jsonResponse.stringOf("issuer");
jwks_uri = jsonResponse.stringOf("jwks_uri");
request_parameter_supported = jsonResponse.BoolOf("request_parameter_supported");
request_uri_parameter_supported = jsonResponse.BoolOf("request_uri_parameter_supported");
token_endpoint = jsonResponse.stringOf("token_endpoint");
userinfo_endpoint = jsonResponse.stringOf("userinfo_endpoint");
introspection_endpoint = jsonResponse.stringOf("introspection_endpoint");
revocation_endpoint = jsonResponse.stringOf("revocation_endpoint");
i = 0;
count_i = jsonResponse.SizeOfArray("acr_values_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("acr_values_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("claims_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("claims_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("grant_types_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("grant_types_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("id_token_signing_alg_values_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("id_token_signing_alg_values_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("response_modes_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("response_modes_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("response_types_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("response_types_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("scopes_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("scopes_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("subject_types_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("subject_types_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("token_endpoint_auth_methods_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("token_endpoint_auth_methods_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("userinfo_signing_alg_values_supported");
while (i < count_i) {
jsonResponse.put_I(i);
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("code_challenge_methods_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("code_challenge_methods_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("introspection_endpoint_auth_methods_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("introspection_endpoint_auth_methods_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("revocation_endpoint_auth_methods_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("revocation_endpoint_auth_methods_supported[i]");
i = i+1;
}
i = 0;
count_i = jsonResponse.SizeOfArray("claim_types_supported");
while (i < count_i) {
jsonResponse.put_I(i);
strVal = jsonResponse.stringOf("claim_types_supported[i]");
i = i+1;
}
}
}