Skip to content

gh-3572 Upgrade to Spring Security 5.2 #3573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

gh-3572 Upgrade to Spring Security 5.2 #3573

wants to merge 2 commits into from

Conversation

ghillert
Copy link
Contributor

  • Upgrade Spring Cloud Common Security dependency
  • Fix tests

resolves #3572

@ghillert ghillert changed the title gh-3572 Upgrade to Spring Security 5.2 [REVIEW_ONLY] gh-3572 Upgrade to Spring Security 5.2 Oct 24, 2019
@ilayaperumalg ilayaperumalg self-assigned this Oct 24, 2019
@@ -37,7 +37,7 @@
/**
* Skip Ssl validation.
*/
private boolean skipSslValidation = true;
private boolean skipSslValidation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we wanted to enable SSL validation by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never "skip ssl validation" by default. I am not sure how that got set to true in the first place.

<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.3.0.RELEASE</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous comment on version management.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this dep doesn't belong here. It needs to come from a transitive deps, which currently is only a cf java client.

@@ -46,6 +46,12 @@
<artifactId>spring-cloud-dataflow-rest-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to avoid using this in tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this for our test as we have an embedded test server. We may have to wait for Spring Security 5.3 to address this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And version dep needs to go to main pom.

token-info-uri: http://127.0.0.1:${oauth2.port}/oauth/check_token
authorization:
check-token-access: isAuthenticated()
provider-role-mappings:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add the documentation specifically on the changes in the properties configuration

ROLE_DESTROY: dataflow.create
ROLE_MODIFY: dataflow.create
ROLE_SCHEDULE: dataflow.create
security:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another important property hierarchical change as well. We need to be explicit about this in the documentation.

@sabbyanandan sabbyanandan changed the title [REVIEW_ONLY] gh-3572 Upgrade to Spring Security 5.2 gh-3572 Upgrade to Spring Security 5.2 Oct 29, 2019
* Upgrade Spring Cloud Common Security dependency
* Fix tests
* Update documentation
@@ -66,23 +66,21 @@

<!-- note - check version of reactor at deployer-cf/cf-java-client uses -->
<spring-cloud-deployer-cloudfoundry.version>2.1.0.BUILD-SNAPSHOT</spring-cloud-deployer-cloudfoundry.version>
<reactor.version>3.2.0.RELEASE</reactor.version>
<reactor.version>3.3.0.RELEASE</reactor.version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that we're going to reactor 3.3.x when cf java client gets to it but why this change with this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a call in Spring Security WebClient that uses an API call of 3.3.x.

@@ -181,12 +182,14 @@ public TaskExecutionService taskService(LauncherRepository launcherRepository,
TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator,
TaskExplorer taskExplorer,
DataflowTaskExecutionDao dataflowTaskExecutionDao,
DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao) {
DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
@Autowired(required = false) OAuth2TokenUtilsService oauth2TokenUtilsService) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In spring5 we can now use Optional or even @Nullable. I think Optional is preferred way these days as this required thing was a spring4 thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to @Nullable

@@ -363,7 +365,8 @@ public StreamDeploymentController updatableStreamDeploymentController(

@Bean
public SkipperClient skipperClient(SkipperClientProperties properties,
RestTemplateBuilder restTemplateBuilder, ObjectMapper objectMapper) {
RestTemplateBuilder restTemplateBuilder, ObjectMapper objectMapper,
@Autowired(required = false) OAuth2TokenUtilsService oauth2TokenUtilsService) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same Optional comment here vs using @Autowired.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to @Nullable

client:
registration:
uaa:
redirect-uri: '{baseUrl}/login/oauth2/code/{registrationId}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find where baseUrl and registrationId are coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--authorized_grant_types password,authorization_code,client_credentials,refresh_token \
--authorities uaa.resource,dataflow.create,dataflow.deploy,dataflow.destroy,dataflow.manage,dataflow.modify,dataflow.schedule,dataflow.view,foo.view,foo.create\
--redirect_uri http://localhost:9393/login \
--autoapprove openid \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the new line character here.


[source,bash]
----
uaac target http://uaa:8080/uaa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it is implicit, we can say, uaa is the local host name in uaa:8080

@ilayaperumalg
Copy link
Contributor

This PR needs to be updated based on the recent package name changes on spring-cloud-common-security-config. Will update when merging.

@ilayaperumalg
Copy link
Contributor

LGTM, merging.

@ilayaperumalg
Copy link
Contributor

Squashed, rebased, fixed the package name conflicts, updated docs on the above comments and merged as 06adfa6 and d61938d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to Spring Security 5.2
3 participants