[keycloak-user] how to use spring boot adapterq

Patrick Boe Patrick.Boe at smartstream-stp.com
Thu Oct 6 08:11:38 EDT 2016


Hello,


I'm trying to understand how to use the spring boot adapter for keycloak. As a test case, I'm attempting to use it from one of the spring boot quickstart projects. Please see the following question:


http://stackoverflow.com/questions/39794779/how-do-i-configure-the-spring-boot-quickstart-for-keycloak


Full text:


0down votefavorite<http://stackoverflow.com/questions/39794779/how-do-i-configure-the-spring-boot-quickstart-for-keycloak#>


I am trying to set up a basic example spring boot site which uses keycloak for security. I have done the following

  *   cloned and ran (gradlew bootRun) the 'complete' example fromhttps://spring.io/guides/gs/serving-web-content/ (https://github.com/spring-guides/gs-serving-web-content.git) to verify that it works
  *   added the following to the project's gradle dependencies:

compile("org.keycloak:keycloak-spring-boot-adapter:2.2.1.Final")
compile("org.keycloak:keycloak-tomcat8-adapter:2.2.1.Final")


  *   put the following in config/application.yml:

spring:
    profiles: default

server.port: 8090

keycloak:
    securityConstraints:
      - securityCollections:
        - name: application section
          authRoles:
              - user
          patterns:
              - /
    realm: stl
    realmKey: MIIBIjANBgkqh[etc...]?
    auth-server-url: http://localhost:8280/auth
    ssl-required: none
    resource: example-ui
    credentials:
        secret: a117[etc...]


With these steps, I believe I've followed all the directions in https://keycloak.gitbooks.io/securing-client-applications-guide/content/v/2.2/topics/oidc/java/spring-boot-adapter.html. But now when I attempt to browse to the application, I get an error. This is what's logged to the console: No login page was defined for FORM authentication in context []

What am I missing to complete configuration of this app? From prior experience with earlier versions of other keycloak adapters, I would expect to have to specify an auth method of KEYCLOAKsomewhere, but I don't know where that would go in spring boot, if indeed it goes anywhere.





________________________________
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.


More information about the keycloak-user mailing list