Пример #1
0
  public InstallationAdapterConfig toInstallationRepresentation(
      RealmModel realmModel, OAuthClientModel model, URI baseUri) {
    InstallationAdapterConfig rep = new InstallationAdapterConfig();
    rep.setRealm(realmModel.getName());
    rep.setRealmKey(realmModel.getPublicKeyPem());
    rep.setSslNotRequired(realmModel.isSslNotRequired());
    rep.setAuthServerUrl(baseUri.toString());
    if (model.isPublicClient()) rep.setPublicClient(true);

    rep.setResource(model.getClientId());

    if (!model.isPublicClient()) {
      Map<String, String> creds = new HashMap<String, String>();
      creds.put(CredentialRepresentation.SECRET, model.getSecret());
      rep.setCredentials(creds);
    }

    return rep;
  }
Пример #2
0
  public InstallationAdapterConfig toInstallationRepresentation(
      RealmModel realmModel, ClientModel clientModel, URI baseUri) {
    InstallationAdapterConfig rep = new InstallationAdapterConfig();
    rep.setAuthServerUrl(baseUri.toString());
    rep.setRealm(realmModel.getName());
    rep.setSslRequired(realmModel.getSslRequired().name().toLowerCase());

    if (clientModel.isPublicClient() && !clientModel.isBearerOnly()) rep.setPublicClient(true);
    if (clientModel.isBearerOnly()) rep.setBearerOnly(true);
    if (clientModel.getRoles().size() > 0) rep.setUseResourceRoleMappings(true);

    rep.setResource(clientModel.getClientId());

    if (showClientCredentialsAdapterConfig(clientModel)) {
      Map<String, Object> adapterConfig = getClientCredentialsAdapterConfig(clientModel);
      rep.setCredentials(adapterConfig);
    }

    return rep;
  }