question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring Boot OAuth2

See original GitHub issue

First of all I would like to say that this project seems very promising and can be used by our company’s internal tools team.

Thank you for your hard work on integrations and documentation.

We use OAuth2 (Keycloak) in our company for authentication. I tried template-fullstack-spring-boot example and added simple oauth security configuration:

  1. implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
  2. simple application.yml Github configuration:
spring:
  security:
    oauth2:
      client:
        registration:
          github:
            clientId: client_id
            clientSecret: client_secret
@Bean    
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
        return http
            .csrf().disable()
            .authorizeExchange().anyExchange().authenticated().and()
            .oauth2Login()
            .and().build()
    }

But after I launch app I am getting: jquery.js?0110:10099 GET http://localhost:3000/login 404 (Not Found)

Should I somehow provide implementation for /login on UI? What is a correct way to handle such situation?

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rjaroscommented, Jun 12, 2020

Hello and thx for you feedback ! 😃

When you are using webpack dev server for development (running on port 3000) you have to configure webpack proxy to pass server side requests to the server (running on port 8080). Template projects are configured to only pass requests to /kv/* endpoints:

https://github.com/rjaros/kvision-examples/blob/fefbdc21e8aa2c82abdbd9693bcf9b983818aca2/template-fullstack-spring-boot/build.gradle.kts#L88

You need to add other endpoint urls in your build.gradle.kts, like here in the addressbook-fullstack-spring-boot example:

https://github.com/rjaros/kvision-examples/blob/fefbdc21e8aa2c82abdbd9693bcf9b983818aca2/addressbook-fullstack-spring-boot/build.gradle.kts#L89

0reactions
glebrodionovcommented, Jun 21, 2020

@rjaros thank you! it works like a charm.

I am fully unblocked and continue working with KVision with pleasure!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial | Spring Boot and OAuth2
Spring Boot and OAuth2 · simple: a very basic static app with just a home page and unconditional login via Spring Boot's OAuth...
Read more >
Spring REST API + OAuth2 + Angular - Baeldung
Simply put, an Authorization Server is an application that issues tokens for authorization. Previously, the Spring Security OAuth stack offered ...
Read more >
Spring Boot - OAuth2 with JWT - Tutorialspoint
Spring Security OAuth2 − Implements the OAUTH2 structure to enable the Authorization Server and Resource Server. Spring Security JWT − Generates the JWT ......
Read more >
Using Spring Boot for OAuth2 and JWT REST Protection - Toptal
Spring Security and Spring Boot permit to quickly set up a complete OAuth2 authorization/authentication server in an almost declarative manner. The setup can...
Read more >
Spring Boot Security - Introduction to OAuth 2 - JavaInUse
Spring Boot Security - Introduction to OAuth2 ... OAuth (Open Authorization) is a simple way to publish and interact with protected data. It...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found