Skip to content

Custom post-login redirection logic #43496

Answered by ccidral
ccidral asked this question in Q&A
Discussion options

You must be logged in to vote

@michalvavrik Thank you for the suggestions, I appreciate that. I'm leaning towards a simpler solution like this:

# application.properties

quarkus.http.auth.form.landing-page=/landing
@Path("/landing")
public class LandingController {
    @Inject
    SecurityIdentity securityIdentity;

    @GET
    @Path("/")
    @Authenticated
    public Response land() {
        if (securityIdentity.getRoles().contains("system.manager")) {
            return Response.seeOther(URI.create("/admin")).build();
        }

        return Response.seeOther(URI.create("/")).build();
    }
}

With the caveat that it has an extra redirection step but I can live with that for the moment.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@ccidral
Comment options

@sberyozkin
Comment options

@michalvavrik
Comment options

@ccidral
Comment options

Answer selected by ccidral
@michalvavrik
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants