Hi Alex,

You can redirect the user to the URL below when the login button is pressed.

Direct link to Login:

Direct link to Registration:

You could also call request.authenticate(response), but in this case you won’t be able to specify the redirect_uri and there’s no way to indicate you want to go directly to login page or registration page.

I think we have the same situation as yours.
Some of our pages are partially visible when the user is not logged in, so we can’t protect it with url pattern.
There’s a bug when you login and get redirected to a page that it’s url is not protected.
The user session data will not be available until you navigate to a page that has the url protected.
We had to do a workaround to solve a part of the problem.
When we go to the login page our redirect_uri is a servlet that is protected, this servlet only redirects back to my page that is not protected.
There’s an issue open at: https://issues.jboss.org/browse/KEYCLOAK-2784

Please let me know if this solved your problem, or if you found a better solution.

Leonardo Nunes

On 27/07/16 07:56, "keycloak-user-bounces@lists.jboss.org on behalf of Bruno Oliveira" <keycloak-user-bounces@lists.jboss.org on behalf of bruno@abstractj.org> wrote:

Hi Alex, please take a look a the examples here[1].

[1] - https://github.com/redhat-developer/redhat-sso-quickstarts

On 2016-07-26, Alex Fernandes wrote:

Im green to KeyCloak; Wanted to thank the community for it, so far looking

I have an issue where I want to redirect the user the loginpage on the
KeyCloak server programmatically in Java;

the UseCase is:

We have a page that is partially visible and partiallly not (when not
logged in), so I can't protect it with url pattern;

We have a login button on that page that when the user is not logged and
pressed the button, we want to redirect to the loginpage (on keycloak) and
back to the page again.

I'm using the KeyCloak adapter core (running on tomcat8)

[image: Inline afbeelding 2]

I coppied this code from the: KeycloakOIDCFilter (

it does show a 302 in the logs but the page doesn't redirect;

Anyone has a clue about how to go about this?

Much Appreciated,


keycloak-user mailing list


PGP: 0x84DC9914
keycloak-user mailing list
Esta mensagem pode conter informação confidencial e/ou privilegiada. Se você não for o destinatário ou a pessoa autorizada a receber esta mensagem, não poderá usar, copiar ou divulgar as informações nela contidas ou tomar qualquer ação baseada nessas informações. Se você recebeu esta mensagem por engano, por favor avise imediatamente o remetente, respondendo o e-mail e em seguida apague-o. Agradecemos sua cooperação.

This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation