anthony-foulfoin / spring-boot-security-oauth2-jwt

An example of how to use a JWT token to secure a Spring Boot 2.x application
22 stars 9 forks source link

Not Work in Springboot 2.0.5 #1

Open tarasare opened 6 years ago

tarasare commented 6 years ago

Why this not work in springboot 2.0.5

Application Properties

`keystore.file=morris.jks

keystore.password=960150

keystore.alias=morris

security.oauth2.client.clientId=client

security.oauth2.client.clientSecret=123456

security.oauth2.client.auto-approve-scopes=true

security.oauth2.client.authorized-grant-types=authorization_code,refresh_token,password

security.oauth2.client.access-token-validity-seconds=86400

security.oauth2.client.scope=openid

security.oauth2.resource.jwt.key-value=-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo2xF0rLcjjuP6nYBGpm1xWlJpIT7iVs+XANcRtZ9DBC7yBjM2oK8Bn1w7EHTw07u3mXqzRu6bsk7uiLlWFUpshSHH/PbsqTbZ1GciD8vetzwi7Fjpa2lfO+oC4EIW2LR/agx16UCo49WEUlA5rk9v39K7peOkhEW1Luv8t+mIF7xn+WsaKTYXigQ2rGx3O9U540zTU4a4ZmsyXB56DVAFnMn2+3FC50OvG4C+2m5wqJ8Sdttpcq0y94txViDcj2snd4qjC40f0rB5lMYrYGLzIivUo2Ft3ygv2h8f2GmydFvTF/+VGslKE2DL/XHVU5QMcP9rGiCqgTVmdkUUP6hHdwIDAQAB\n-----END PUBLIC KEY-----`

POM.xml

`

org.springframework.boot
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.5.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

........................... ................................

org.springframework.cloud spring-cloud-starter-oauth2
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

................................... ...............................

`

response { "error": "unauthorized", "error_description": "Full authentication is required to access this resource" }

anthony-foulfoin commented 6 years ago

For now it only works with spring boot 1.5.x I didn't update it to spring boot 2.x yet.