# User redirect after login

**URL:** <https://forum.payara.fish/t/user-redirect-after-login/779>\
**Category:** Payara Server\
**Tags:** security\
**Created:** [February 22, 2024, 6:06pm UTC](https://forum.payara.fish/t/user-redirect-after-login/779 "2024-02-22T18:06:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brasta78](https://avatars.discourse-cdn.com/v4/letter/b/59ef9b/32.png) [@brasta78](https://forum.payara.fish/u/brasta78)\
**Post date:** [February 22, 2024, 6:06pm UTC](https://forum.payara.fish/t/user-redirect-after-login/779/1 "2024-02-22T18:06:40Z")

</div>

hi,

I use CustomFormAuthenticationMechanismDefinition for my web app and I want to redirect to a different welcome page based on logged in user group. What is a recommended approach to do that?

---

<div class="post-metadata">

**Author:** ![brasta78](https://avatars.discourse-cdn.com/v4/letter/b/59ef9b/32.png) [@brasta78](https://forum.payara.fish/u/brasta78)\
**Post date:** [February 23, 2024, 5:51pm UTC](https://forum.payara.fish/t/user-redirect-after-login/779/2 "2024-02-23T17:51:35Z")

</div>

OK a little bit more inforamtion:  
My web.xml setting:

```auto
 <welcome-file-list>
    <welcome-file>app/index.xhtml</welcome-file>
</welcome-file-list>

```

I have settings for these security-constraint with recquired auth-constraint for access

```auto
/app/* is an application users area
/client/* is client path

```

For login action I have this code:

```auto
public void execute() throws IOException {
    switch (processAuthentication()) {
        case SEND_CONTINUE:               
            fc.responseComplete();
            break;
        case SEND_FAILURE:                
            fc.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Invalid Credentials", null));
            break;
        case SUCCESS:              
            if (isClientRole()) {
                context.redirect(context.getRequestContextPath() + "/client/nets.xhtml");
            } else {                    
                context.redirect(context.getRequestContextPath() + "/app/index.xhtml");
            }
            break;
    }
}

private AuthenticationStatus processAuthentication() {
    return securityContext.authenticate((HttpServletRequest) context.getRequest(),
            (HttpServletResponse) context.getResponse(),
            AuthenticationParameters.withParams()                        
                    .credential(new UsernamePasswordCredential(username, password)));
}

```

SUCCESS part works as expected, but SEND\_CONTINUE part is still unknown behavior like described in this [question](https://stackoverflow.com/questions/64750354/on-a-successful-login-securitycontext-authenticate-returns-authenticationstat/77983880#77983880) and I can’t find, how to control it.
