Class PrincipalResource

java.lang.Object
ch.tocco.nice2.rest.core.spi.AbstractRestResource
ch.tocco.nice2.rest.principal.impl.resources.PrincipalResource
All Implemented Interfaces:
RestResource

@Path("/principals/{usernameOrPk: (?!.*(businessunits))[^/]+}") public class PrincipalResource extends AbstractRestResource
  • Constructor Details

  • Method Details

    • setPrivilegedRoles

      @Autowired(required=false) public void setPrivilegedRoles(List<String> privilegedRoles)
    • validatePassword

      @POST @Path("/password-validation") @Produces("application/json") @Consumes("application/json") public ValidationResultBean validatePassword(@PathParam("usernameOrPk") String usernameOrPk, UpdatePasswordBean passwordBean)
      Validates the new password of a certain principal against the password policy
      Parameters:
      usernameOrPk - username or primary key of the principal whose password will be validated
      passwordBean - bean which contains the password to be validated. If the user is not authenticated currently, the bean must contain the current password (= old password) for authentication.
      Returns:
      the validation result
    • updatePassword

      @POST @Path("/password-update") @Consumes("application/json") public jakarta.ws.rs.core.Response updatePassword(@PathParam("usernameOrPk") String usernameOrPk, UpdatePasswordBean passwordBean)
      Updates the password of a principal
      Parameters:
      usernameOrPk - username or primary key of the principal whose password will be changed
      passwordBean - bean which contains the new and old (optional for usermanager) passwords. If the user is not authenticated currently, the bean must contain the current password (= old password) for authentication.
      Returns:
      Status 200 on success
    • resetPassword

      @POST @Path("/password-reset") public jakarta.ws.rs.core.Response resetPassword(@PathParam("usernameOrPk") String usernameOrPk)
      Resets the password of a principal
      Parameters:
      usernameOrPk - username of the principal whose password will be reset
      Returns:
      Status 200 on success (else 400 - regardless of the actual error)
    • getPasswordRules

      @GET @Path("/password-rules") @Produces("application/json") public PasswordRulesBean getPasswordRules(@PathParam("usernameOrPk") String username)
      Returns the password validation rules
      Parameters:
      username - username of the principal to get the validation rules for
      Returns:
      the current password policy for the given principal
    • changeBusinessUnit

      @PUT @Path("/businessunit") @Consumes("application/json") public void changeBusinessUnit(@PathParam("usernameOrPk") String usernameOrPk, BusinessUnitChangeBean businessUnitBean)
    • generateTwoFactorAuthenticationSecret

      @GET @Path("/two-factor") @Produces("application/json") public TwoFactorBean generateTwoFactorAuthenticationSecret(@PathParam("usernameOrPk") String usernameOrPk)
    • activateTwoFactorAuthentication

      @POST @Path("/two-factor") @Consumes("application/json") public void activateTwoFactorAuthentication(@PathParam("usernameOrPk") String usernameOrPk, TwoFactorActivateBean twoFactorActivateBean)