When using simple spring boot configuration with normal spring parent in pom.xml I have no problem configuring oauth2 resource server.
However with JHipster dependency management by no means i can configure it. I was trying to do it just by adding
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
<version>[spring version]</version>
</dependency>
or by using some older configuration with other dependencies like here: https://docs.spring.io/spring-security-oauth2-boot/docs/2.2.x-SNAPSHOT/reference/html/boot-features-security-oauth2-resource-server.html
And normally it works, but with JHipster I get @EnableResourceServer annotation, but I dont have in IntelliJ spring.security.oauth2.resourceserver
property. So I cant configure by what server should the token be validated, and I dont have .oauth2ResourceServer()
method in HttpSecurity http (WebSecurityConfigurerAdapter). I don't understand why is this happening. How can I get these properties? Or maybe I can override it by custom configuration somehow?
CodePudding user response:
JHipster is configured to be a resource server by default, so you don't need to add any additional configuration.
From SecurityConfiguration.java:
.oauth2ResourceServer()
.jwt()
.jwtAuthenticationConverter(authenticationConverter())
.and()
.and()
.oauth2Client();
CodePudding user response:
Hello i did it this way, 1-find the .yo-rc.json file of you project 2-open the file and find the tag "authenticationType", it should appear like "authenticationType": "jwt", change it to "authenticationType": "oauth2" 3 - run again the jhipster command in your project.
Here you have a video: https://www.youtube.com/watch?v=YIRjgd_3sMQ