Search in sources :

Example 1 with PasswordResetTokenRequestDTO

use of com.nexblocks.authguard.api.dto.requests.PasswordResetTokenRequestDTO in project AuthGuard by AuthGuard.

the class CredentialsRoute method createResetToken.

@Override
public void createResetToken(final Context context) {
    final PasswordResetTokenRequestDTO request = passwordResetTokenRequestBodyHandler.getValidated(context);
    if (!ActorDomainVerifier.verifyActorDomain(context, request.getDomain())) {
        return;
    }
    final AppBO actor = context.attribute("actor");
    final boolean isAuthClient = actor.getRoles().contains(AuthGuardRoles.AUTH_CLIENT);
    final PasswordResetTokenBO token = credentialsService.generateResetToken(request.getIdentifier(), !isAuthClient, // prevent an auth client from seeing the reset token
    request.getDomain());
    context.json(restMapper.toDTO(token));
}
Also used : PasswordResetTokenRequestDTO(com.nexblocks.authguard.api.dto.requests.PasswordResetTokenRequestDTO)

Aggregations

PasswordResetTokenRequestDTO (com.nexblocks.authguard.api.dto.requests.PasswordResetTokenRequestDTO)1