コード例 #1
0
  /**
   * Update authenticator configuration
   *
   * @param id Configuration id
   * @param rep JSON describing new state of authenticator configuration
   */
  @Path("config/{id}")
  @PUT
  @Consumes(MediaType.APPLICATION_JSON)
  @NoCache
  public void updateAuthenticatorConfig(
      @PathParam("id") String id, AuthenticatorConfigRepresentation rep) {
    auth.requireManage();

    AuthenticatorConfigModel exists = realm.getAuthenticatorConfigById(id);
    if (exists == null) {
      throw new NotFoundException("Could not find authenticator config");
    }
    exists.setAlias(rep.getAlias());
    exists.setConfig(rep.getConfig());
    realm.updateAuthenticatorConfig(exists);
    adminEvent.operation(OperationType.UPDATE).resourcePath(uriInfo).representation(rep).success();
  }