private void parseGrantTypeParameter(RoutingContext context) { String grantType = context.request().getParam(OAuth2Constants.GRANT_TYPE); if (grantType == null) { throw new InvalidRequestException("Missing parameter: grant_type"); } }
private void parseClientIdParameter(RoutingContext context) { String clientId = context.request().getParam(OAuth2Constants.CLIENT_ID); if (clientId == null) { throw new InvalidRequestException("Missing parameter: client_id"); } }
private void parseClientIdParameter(RoutingContext context) { String clientId = context.request().getParam(OAuth2Constants.CLIENT_ID); if (clientId == null) { throw new InvalidRequestException("Missing parameter: client_id"); } }
private void parseNonceParameter(RoutingContext context) { String nonce = context.request().getParam(OIDCParameters.NONCE); String responseType = context.request().getParam(OAuth2Constants.RESPONSE_TYPE); // nonce parameter is required for the Hybrid flow if (nonce == null && requireNonce(responseType)) { throw new InvalidRequestException("Missing parameter: nonce is required for Implicit and Hybrid Flow"); } } }
private void parseGrantTypeParameter(RoutingContext context) { String grantType = context.request().getParam(OAuth2Constants.GRANT_TYPE); if (grantType == null) { throw new InvalidRequestException("Missing parameter: grant_type"); } }
private void parseNonceParameter(RoutingContext context) { String nonce = context.request().getParam(OIDCParameters.NONCE); String responseType = context.request().getParam(OAuth2Constants.RESPONSE_TYPE); // nonce parameter is required for the Hybrid flow if (nonce == null && requireNonce(responseType)) { throw new InvalidRequestException("Missing parameter: nonce is required for Implicit and Hybrid Flow"); } } }
private void handleDeleteOne(RoutingContext context) { String todoID = context.request().getParam("todoId"); sendResponse(context, service.delete(todoID), this::noContent); }
private void parseResponseTypeParameter(RoutingContext context) { String responseType = context.request().getParam(OAuth2Constants.RESPONSE_TYPE); if (responseType == null) { throw new InvalidRequestException("Missing parameter: response_type"); } // get supported response types List<String> responseTypesSupported = openIDDiscoveryService.getConfiguration("/").getResponseTypesSupported(); if (!responseTypesSupported.contains(responseType)) { throw new UnsupportedResponseTypeException("Unsupported response type: " + responseType); } }
private void parseResponseTypeParameter(RoutingContext context) { String responseType = context.request().getParam(OAuth2Constants.RESPONSE_TYPE); if (responseType == null) { throw new InvalidRequestException("Missing parameter: response_type"); } // get supported response types List<String> responseTypesSupported = openIDDiscoveryService.getConfiguration("/").getResponseTypesSupported(); if (!responseTypesSupported.contains(responseType)) { throw new UnsupportedResponseTypeException("Unsupported response type: " + responseType); } }
@Override public void handle(RoutingContext context) { final String password = context.request().getParam(passwordParam); User user = context.get("user"); user.setPassword(password); userService.resetPassword(user) .subscribe( () -> redirectToPage(context, Collections.singletonMap("success", "reset_password_completed")), error -> redirectToPage(context, Collections.singletonMap("error", "reset_password_failed"), error)); } }
@Override public void handle(RoutingContext context) { final String password = context.request().getParam(passwordParam); User user = context.get("user"); user.setPassword(password); userService.confirmRegistration(user) .subscribe( () -> redirectToPage(context, Collections.singletonMap("success", "registration_completed")), error -> redirectToPage(context, Collections.singletonMap("error", "registration_failed"), error)); } }
@Override public void handle(RoutingContext context) { final String password = context.request().getParam(passwordParam); User user = context.get("user"); user.setPassword(password); userService.confirmRegistration(user) .subscribe( () -> redirectToPage(context, Collections.singletonMap("success", "registration_completed")), error -> redirectToPage(context, Collections.singletonMap("error", "registration_failed"), error)); } }
@Override public void handle(RoutingContext rc) { String return_url = rc.request().getParam("return_url"); Session session = rc.session(); if (return_url != null && session != null) { session.put("return_url", return_url); } rc.next(); } }
@Override public void handle(RoutingContext context) { final String password = context.request().getParam(passwordParam); User user = context.get("user"); user.setPassword(password); userService.resetPassword(user) .subscribe( () -> redirectToPage(context, Collections.singletonMap("success", "reset_password_completed")), error -> redirectToPage(context, Collections.singletonMap("error", "reset_password_failed"), error)); } }
@Override public void handle(RoutingContext context) { final String userId = context.request().getParam("id"); userService.delete(userId) .subscribe( () -> context.response().setStatusCode(204).end(), error -> context.fail(error)); }
@Override public void handle(RoutingContext context) { final String groupId = context.request().getParam("id"); groupService.delete(groupId) .subscribe( () -> context.response().setStatusCode(204).end(), error -> context.fail(error)); }
@Override public void handle(RoutingContext context) { final String userId = context.request().getParam("id"); userService.delete(userId) .subscribe( () -> context.response().setStatusCode(204).end(), error -> context.fail(error)); }
@Override public void handle(RoutingContext context) { final String groupId = context.request().getParam("id"); groupService.delete(groupId) .subscribe( () -> context.response().setStatusCode(204).end(), error -> context.fail(error)); }
private void parseClaimsParameter(RoutingContext context) { String claims = context.request().getParam(OIDCParameters.CLAIMS); if (claims != null) { try { ClaimsRequest claimsRequest = claimsRequestResolver.resolve(claims); // save claims request as json string value (will be use for id_token and/or UserInfo endpoint) context.request().params().set(OIDCParameters.CLAIMS, Json.encode(claimsRequest)); } catch (ClaimsRequestSyntaxException e) { throw new InvalidRequestException("Invalid parameter: claims"); } } }
private void updateOne(RoutingContext rc) { String id = rc.request().getParam("id"); Article article = rc.getBodyAsJson().mapTo(Article.class); connect() .flatMapCompletable(connection -> update(connection, id, article)) .subscribe(noContent(rc), onError(rc)); }