Exemplo n.º 1
0
  public void update(OAuthClientRepresentation rep, OAuthClientModel model) {
    if (rep.getName() != null) model.setClientId(rep.getName());
    if (rep.isEnabled() != null) model.setEnabled(rep.isEnabled());
    if (rep.isPublicClient() != null) model.setPublicClient(rep.isPublicClient());
    if (rep.getClaims() != null) {
      ClaimManager.setClaims(model, rep.getClaims());
    }
    if (rep.getNotBefore() != null) {
      model.setNotBefore(rep.getNotBefore());
    }
    if (rep.getSecret() != null) model.setSecret(rep.getSecret());
    List<String> redirectUris = rep.getRedirectUris();
    if (redirectUris != null) {
      model.setRedirectUris(new HashSet<String>(redirectUris));
    }

    List<String> webOrigins = rep.getWebOrigins();
    if (webOrigins != null) {
      model.setWebOrigins(new HashSet<String>(webOrigins));
    }

    if (rep.getClaims() != null) {
      ClaimManager.setClaims(model, rep.getClaims());
    }

    if (rep.getNotBefore() != null) {
      model.setNotBefore(rep.getNotBefore());
    }
  }
Exemplo n.º 2
0
 public OAuthClientModel create(OAuthClientRepresentation rep) {
   OAuthClientModel model = create(rep.getName());
   update(rep, model);
   return model;
 }