Fork me on GitHub

Programming, Internet & more

Authentication with Spring Boot, Angular 2 and Keycloak

Category: spring, spring-boot

9 Comments

  • Pankaj says:

    Thanks for writing. Great articlet.

  • Andy says:

    Good article except it doesn’t want to work for me.

    Frontend app appears to start ok.
    Backend app appears to start ok.

    I get the log in page but then after entering the username & pw I get a keycloak error “Unexpected error when handling authentication request to identity provider.”

    There is a stack trace on KC with the following message…

    [org.keycloak.services] (default task-3) KC-SERVICES0013: Failed authentication: java.lang.RuntimeException: org.keycloak.jose.jwe.JWEException: java.security.InvalidKeyException: Illegal key size

    Running KC 3.4.0, Java 1.8 on Windows 10.

  • Celso says:

    Hello,
    Thanks a lot for the great tutorial on keycloak.

    I’m a beginner in spring security and I need help to make my spring boot applications safer.
    I created two simple examples using spring boot:

    1. API (to be secured): https://github.com/crcpucminas/api-service
    2. An API Client (which must access the api): https://github.com/crcpucminas/api-client

    I would like to use keycloack (OAuth 2.0) to protect the API and grant access to API Client.

    So, I need guidance to:

    1. Configure keycloack (realm, hole, user, etc.);
    2. Set the API configuration (application.properties); and
    3. Set the API Client configuration (application.properties, configuration classes, etc.).

    Any help would be appreciated.

    Thank you very much.

  • mahesh loya says:

    Thank for the clear and crisp blog,this is really helpful.

    I have created two client in keycloak admin console,in same realm(testRealm).

    front-end client’s ACCESS-TYPE is “Public”.

    Backend client(backendService) ACCESS-TYPE is “Bearer-only”.

    Front-End is working fine and displays tabs based on roles.

    When I try to hit/access backend service call, it gives me below error in browser console-

    Failed to load http://localhost:9099/api/transaction

    Response for preflight has invalid HTTP status code 401.

    I have raised a SO question,can you please help.

    https://stackoverflow.com/questions/48601044/spring-boot-keycloak-bearer-only-for-backend-service-not-working

  • Satya says:

    Superb, Thanks to you and the keycloak team.

  • tarsidi says:

    Hi, how we can add redirectUri to javascript adapter?
    thanks

  • Satya says:

    Thanks for this wonderful demo application, if you have time would you be willing to release another version using the httpclient module…

  • Stephane says:

    A sequel showing how to offer the login from within the front end application would be nice.

  • s says:

    If i want to secure the spring url for nobody can access it then how in keycloak

1 Trackback

Leave a Reply

Your email address will not be published. Required fields are marked *