net.loginbuddy.common/src/main/java/net/loginbuddy/common/api/HttpHelper.java
/**
   * This template matches what is configured in config.json. At least for fields that should be provided through an OpenID Connect Discovery endpoint and the Registration
   *
   * @param oidcConfig
   * @param registration
   * @param redirectUri
   * @param updateProvider
   * @param updateIssuer
   * @return
   */
This template matches what is configured in config.json.
This template matches what is configured in config . json .
private static JSONObject providerTemplate(JSONObject oidcConfig, JSONObject registration, String redirectUri, boolean updateProvider, boolean updateIssuer) {
    JSONObject config = new JSONObject();
    config.put("client_id", registration.get(Constants.CLIENT_ID.getKey()));
    config.put("client_secret", registration.get(Constants.CLIENT_SECRET.getKey()));
    config.put("redirect_uri", redirectUri);
    config.put("scope", HttpHelper.jsonArrayToString((JSONArray) oidcConfig.get(Constants.SCOPES_SUPPORTED.getKey())));
    config.put("authorization_endpoint", oidcConfig.get(Constants.AUTHORIZATION_ENDPOINT.getKey()));
    config.put("token_endpoint", oidcConfig.get(Constants.TOKEN_ENDPOINT.getKey()));
    config.put("userinfo_endpoint", oidcConfig.get(Constants.USERINFO_ENDPOINT.getKey()));
    config.put("jwks_uri", oidcConfig.get(Constants.JWKS_URI.getKey()));
    if (updateIssuer) {
      config.put("issuer", oidcConfig.get(Constants.ISSUER.getKey()));
    }
    if (updateProvider) {
      config.put("provider", oidcConfig.get(Constants.ISSUER.getKey()));
    }
    config.put("response_type", "code");
    return config;
  }
private static JSONObject providerTemplate ( JSONObject oidcConfig , JSONObject registration , String redirectUri , boolean updateProvider , boolean updateIssuer ) { JSONObject config = new JSONObject ( ) ; config . put ( "client_id" , registration . get ( Constants . CLIENT_ID . getKey ( ) ) ) ; config . put ( "client_secret" , registration . get ( Constants . CLIENT_SECRET . getKey ( ) ) ) ; config . put ( "redirect_uri" , redirectUri ) ; config . put ( "scope" , HttpHelper . jsonArrayToString ( ( JSONArray ) oidcConfig . get ( Constants . SCOPES_SUPPORTED . getKey ( ) ) ) ) ; config . put ( "authorization_endpoint" , oidcConfig . get ( Constants . AUTHORIZATION_ENDPOINT . getKey ( ) ) ) ; config . put ( "token_endpoint" , oidcConfig . get ( Constants . TOKEN_ENDPOINT . getKey ( ) ) ) ; config . put ( "userinfo_endpoint" , oidcConfig . get ( Constants . USERINFO_ENDPOINT . getKey ( ) ) ) ; config . put ( "jwks_uri" , oidcConfig . get ( Constants . JWKS_URI . getKey ( ) ) ) ; if ( updateIssuer ) { config . put ( "issuer" , oidcConfig . get ( Constants . ISSUER . getKey ( ) ) ) ; } if ( updateProvider ) { config . put ( "provider" , oidcConfig . get ( Constants . ISSUER . getKey ( ) ) ) ; } config . put ( "response_type" , "code" ) ; return config ; }
This template matches what is configured in config.json.
This template matches what is configured in config . json .