#Spring cloud starter security was removed in spring cloud update 2020.0
138 messages · Page 1 of 1 (latest)
Hey, @somber mauve!
Please remember to /close this post once your question has been answered!
<@&765578700724371486>
Spring cloud start security was removed in spring cloud update 2020.0
Spring cloud starter security was removed in spring cloud update 2020.0
just use the other spring-cloud-xxx dependencies?
can you explain more please? I am new to spring
This are the plugins I have
id 'checkstyle'
id 'com.github.sherter.google-java-format' version '0.9'
id 'com.google.cloud.tools.jib' version '3.1.4'
id 'idea'
id 'io.freefair.lombok' version '6.4.2'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
id 'name.remal.sonarlint' version '1.0.164' // 1.0.165+ causes jakarta.validation/javax.validation conflict
id 'org.springframework.boot' version '2.5.14'
id 'org.owasp.dependencycheck' version '6.0.3'
id 'org.sonarqube' version '2.8'
id 'jacoco'
}```
These are the depencies I have
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2021.0.4'
}
}
dependencies {
implementation 'io.micrometer:micrometer-registry-elastic:1.3.4'
implementation 'io.micrometer:micrometer-registry-prometheus:1.7.4'
implementation 'io.zipkin.aws:brave-propagation-aws:0.21.2'
implementation 'io.zipkin.aws:zipkin-reporter-xray-udp:0.21.2'
implementation 'net.logstash.logback:logstash-logback-encoder:6.3'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
// TODO: Remove starter-security
implementation 'org.springframework.cloud:spring-cloud-starter-security'
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation 'org.springframework.session:spring-session-data-redis'```
What do you need spring cloud starter security for?
I dont know thats the thing
just remove it and see what doesn't work?
So
/proxy/filter/RefreshAuthTokenGatewayFilterFactory.java:15: error: package org.springframework.cloud.security.oauth2.gateway does not exist
import org.springframework.cloud.security.oauth2.gateway.TokenRelayGatewayFilterFactory;
^
1 error
It needs it for that
https://github.com/spring-cloud/spring-cloud-gateway/issues/1889 it was moved to spring cloud gateway
The class TokenRelayGatewayFilterFactory contains a deprecation comment (see https://github.com/spring-cloud/spring-cloud-security/blob/bc697b580edde87cfa11bedb68ade0258bc84c94/spring-cloud-securit...
Ok let me check that out tomorrow
What i need to do to fix this problem
if you can explain more about the solution you found
Change the dependency to this one
oh but i have implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
**I have removed **
- org.springframework.cloud:spring-cloud-starter-security
- org.springframework.cloud:spring-cloud-starter-kubernetes-all
I have updated
- Java 17,
- Spring cloud 2021.0.4,
- Spring boot 2.5.14,
- Gradle 7.4.x,
Current spring dependencies
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation 'org.springframework.session:spring-session-data-redis'```
**I run the program ./gradlew bootRun**
```java
/proxy/filter/RefreshAuthTokenGatewayFilterFactory.java:15: error: package org.springframework.cloud.security.oauth2.gateway does not exist.
import org.springframework.cloud.security.oauth2.gateway.TokenRelayGatewayFilterFactory;```
**What I do wrong?**
🤔
I am looking for this TokenRelayGatewayFilterFactory class
It was imported class inside the spring-cloud-starter-security
But now the spring-cloud-starter-security has been deleted from spring-cloud project
What spring project they moved this class to?
@drifting badge
@fierce surge
Spring cloud gateway
ok let me try that
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
this?
?
it doesnt work
same error
The class TokenRelayGatewayFilterFactory contains a deprecation comment (see https://github.com/spring-cloud/spring-cloud-security/blob/bc697b580edde87cfa11bedb68ade0258bc84c94/spring-cloud-securit...
I seen this but could you explain how can that help me
I understand they moved TokenRelayGatewayFilterFactory to spring-cloud-gateway
Is this correct? implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
To run your own gateway use the spring-cloud-starter-gateway dependency.
why it doesnt work then
what dependencies are needed to use spring cloud starter gateway
yeah something like that
and don't forget to update/reload the project in your IDE
telling your IDE that you made changes
no idea how to do it in VSC but you can try restarting
like you may need to inform the autocomplete that you changed what libraries are used etc
so that the stuff needs to be redownloaded etc
as I said, idk whether VSC needs it/how to do it with VSC
In IntelliJ, I think you can open the Gradle tab on the right
and then there should be a refresh symbol
and maybe try running gradlew build
oh isee
% ./gradlew build
Task :verifyGoogleJavaFormat
The following files are not formatted properly:
filter/FirstLoginGatewayFilterFactory.java
proxy/filter/RefreshAuthTokenGatewayFilterFactory.java
Task :verifyGoogleJavaFormat FAILED
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':verifyGoogleJavaFormat'.
Problems: formatting style violations
seems like the project requires to follow some style guidelines which it doesn't
hmm
ok I fixed the styling
but i have still the same problem
import org.springframework.cloud.security.oauth2.gateway.TokenRelayGatewayFilterFactory;
^
1 error
I have these dependencies
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
// Changes 31.10.2022
implementation 'org.springframework.cloud:spring-cloud-starter'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'
implementation 'org.springframework.cloud:spring-cloud-starter-task'
// ----- ----- ----- ----- ----- -----
implementation 'org.springframework.security:spring-security-oauth2-jose'
@fierce surge , @drifting badge
no need to ping, we (or at least I) will see it eventually anyways
Does gradlew build run successfully?
it is a part of Spring Cloud Gateway
make sure that the version of Spring Cloud Gateway is sufficiently recent
Nope it gives the error I put above this chat
As you can see it doesn't define the version
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.cloud:spring-cloud-starter'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation 'org.springframework.session:spring-session-data-redis'```
What version of Spring Boot do you use?
id 'org.springframework.boot' version '2.7.5'
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2021.0.4'
yeah, update those
cloud and boot?
maybe it wasn't yet moved in that version
hmm but i got instructed I have to use 2021.0.4
what?
spring cloud
maybe try updating Spring Boot but not Spring cloud?
oh yea but on spring boot I got instructed to use 2.7.x
actually the latest version is 2.7.5
same thing here 2021.0.4
oh I thought there were 2.7.x releases after 2.7.5
ahhh why is version 2021.0.4 from 2022..?
because there are a lot of changes
true
the previous project spring cloud was hoxtron sr8
and id 'org.springframework.boot' version '2.3.12.RELEASE'
that's from 2020
yeah
those were all between
ok Spring Cloud Gateway 3.1.4 which is included in Spring Cloud 2021.0.4 definetely has TokenRelayGatewayFilterFactory
Can you show your whole build.gradle?
ok
or actually, run gradle -q dependencies
that should show you the dependencies in use
it's all dependencies
yeah
and make sure to use the correct package for TokenRelayGatewayFilterFactory
it should be org.springframework.cloud.gateway.filter.factory.TokenRelayGatewayFilterFactory
| +--- org.springframework.cloud:spring-cloud-gateway-server:3.1.4
oh on the path it said security.
you are definetely using the right version
it was moved away
Security-->Gateway
and the package name was updated as well
oh
it looks like
it doesnt complain anymore about that TokenRelayGatewayFilterFactory
lol