Skip to content

Commit

Permalink
fix return
Browse files Browse the repository at this point in the history
  • Loading branch information
tipsy committed Jul 4, 2023
1 parent 045396b commit 8d2e453
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions _posts/tutorials/2017-08-24-javalin-auth-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,12 @@ This translates nicely into code:
{% capture java %}
public static void accessManager(Handler handler, Context ctx, Set<RouteRole> permittedRoles) {
if (permittedRoles.contains(Role.ANYONE)) {
return handler.handle(ctx);
handler.handle(ctx);
return;
}
if (ctx.userRoles().stream().anyMatch(permittedRoles::contains)) {
return handler.handle(ctx);
handler.handle(ctx);
return;
}
ctx.header(Header.WWW_AUTHENTICATE, "Basic");
throw new UnauthorizedResponse();
Expand Down

0 comments on commit 8d2e453

Please sign in to comment.