use of com.nexblocks.authguard.api.dto.entities.RequestValidationError in project AuthGuard by AuthGuard.
the class VerificationRoute method verifyEmail.
public void verifyEmail(final Context context) {
final String token = context.queryParam("token");
if (token == null) {
context.status(400).json(new RequestValidationError(Collections.singletonList(new Violation("token", ViolationType.MISSING_REQUIRED_VALUE))));
}
verificationService.verifyEmail(token);
context.status(200);
}
use of com.nexblocks.authguard.api.dto.entities.RequestValidationError in project AuthGuard by AuthGuard.
the class OAuthRoute method authorize.
void authorize(final Context context) {
final String provider = context.queryParam("provider");
final String state = context.queryParam("state");
final String code = context.queryParam("code");
if (provider == null) {
context.status(400).json(new RequestValidationError(Collections.singletonList(new Violation("provider", ViolationType.MISSING_REQUIRED_VALUE))));
return;
}
if (state == null) {
context.status(400).json(new RequestValidationError(Collections.singletonList(new Violation("state", ViolationType.MISSING_REQUIRED_VALUE))));
return;
}
if (code == null) {
context.status(400).json(new RequestValidationError(Collections.singletonList(new Violation("code", ViolationType.MISSING_REQUIRED_VALUE))));
return;
}
context.json(oAuthService.exchangeAuthorizationCode(provider, state, code));
}
use of com.nexblocks.authguard.api.dto.entities.RequestValidationError in project AuthGuard by AuthGuard.
the class ExceptionHandlers method requestValidationException.
public static void requestValidationException(final RequestValidationException e, final Context context) {
final RequestValidationError error = new RequestValidationError(e.getViolations());
context.status(400).json(error);
}
use of com.nexblocks.authguard.api.dto.entities.RequestValidationError in project AuthGuard by AuthGuard.
the class OAuthRoute method getAuthUrl.
void getAuthUrl(final Context context) {
final String provider = context.queryParam("provider");
if (provider == null) {
context.status(400).json(new RequestValidationError(Collections.singletonList(new Violation("provider", ViolationType.MISSING_REQUIRED_VALUE))));
} else {
final String url = oAuthService.getAuthorizationUrl(provider).join();
context.redirect(url);
}
}
Aggregations