[keycloak-user] Angular2 app with non-authenticated pages
Stan Silvert
ssilvert at redhat.com
Mon Feb 6 07:53:00 EST 2017
Thanks for the tips.
On 2/6/2017 6:03 AM, Kevin Berendsen wrote:
>
> Hi,
>
> Our initiation of the Keycloak JS adapter happens after the user tries his first attempt to access an authenticated-only page. We developed a very simple abstract class that will act as our authenticated component and will be extended by all components which requires an authenticated user. So our initiation logic is contained by our abstract authenticated component class.
>
> This solution only requires a little refactoring in your codebase and some additional code.
>
> Tip: remove the reload page logic in the catch clause when you try to initiate the Keycloak JS adapter. You might end up in redirect infinite loops.
>
> Kind regards,
> Kevin Berendsen
>
> -----Oorspronkelijk bericht-----
> Date: Mon, 6 Feb 2017 10:47:29 +0000
> From: Plunkett McGurk <plunkett_mcgurk at accelerite.com>
> Subject: [keycloak-user] Angular2 app with non-authenticated pages
> To: "keycloak-user at lists.jboss.org" <keycloak-user at lists.jboss.org>
> Message-ID:
> <BM1PR01MB0851B2EC94B85E3E104284E7E1400 at BM1PR01MB0851.INDPRD01.PROD.OUTLOOK.COM>
>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi Guys,
>
> In the Angular2 examples code the Keycloak service is initialised before Angular2 is bootstrapped. (https://github.com/keycloak/keycloak/blob/master/examples/demo-template/angular2-product-app/src/main/webapp/app/main.ts)
>
> I'm my Angular2 app I have a landing page which should be non-secured i.e. I don't need to login to view it. However because Keycloak wraps everything, it first hits the landing page and then redirects the user to login.
>
> So can anyone explain the proper way to do this? It would be great if the examples could be extended to show how keycloak can be integrated with non-secure pages
>
> Many thanks
> Plunkett
>
>
>
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is the property of Accelerite, a Persistent Systems business. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Accelerite, a Persistent Systems business does not accept any liability for virus infected mails.
>
>
> ------------------------------
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
More information about the keycloak-user
mailing list