Skip to content

feat: apiml Spring-Modulith based module with ZAAS service #4108

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

Open
wants to merge 394 commits into
base: v3.x.x
Choose a base branch
from

Conversation

taban03
Copy link
Contributor

@taban03 taban03 commented May 19, 2025

Description

Include ZAAS service as part of Spring Modulith API ML module.

Linked to # (issue)
Part of the # (epic)

Type of change

  • feat: New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • PR title conforms to commit message guideline ## Commit Message Structure Guideline
  • I have commented my code, particularly in hard-to-understand areas. In JS I did provide JSDoc
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The java tests in the area I was working on leverage @nested annotations
  • Any dependent changes have been merged and published in downstream modules

Pablo Carle and others added 30 commits April 10, 2025 13:31
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
Signed-off-by: sj895092 <[email protected]>
Signed-off-by: sj895092 <[email protected]>
private final Reason reason;

public AccessTokenBodyNotValidException(Reason reason) {
super(reason.getMessageKey());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we replace this with a human-readable message? Actually, the exception is never thrown. It is maybe a question of whether we need it. Maybe calling a method that just generates a message is enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

@achmelo is on this one I think

.map(SecurityContext::getAuthentication)
.filter(Objects::nonNull)
.filter(Authentication::isAuthenticated)
.filter(TokenAuthentication.class::isInstance)
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is not true (ie. x509), what is the response? 404 because of Mono.empty? Do we really need to define the type of authentication? Method `getPrincipal is everywhere, so I consider it redundant.

Copy link
Contributor

Choose a reason for hiding this comment

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

This comes from the original implementation in zaas-service's SuccessfulTicketHandler
I believe the /ticket endpoint doesn't have user mapping x509 authentication supported, it only has certificate like /eureka/** endpoints do

Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to add suppot for the additional method we should probably create a feature

Signed-off-by: Andrea Tabone <[email protected]>
Signed-off-by: Pablo Carle <[email protected]>
new X509Certificate[]{clientCertFromHeader.get()},
certificateForClientAuth
);
exchange.getAttributes().put(ATTR_NAME_CLIENT_AUTH_X509_CERTIFICATE, clientAuthCerts);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are in the WebFlux we should mainly focus on SslInfo and replace it like here:

var sslInfo = AttlsSslInfo.builder().peerCertificates(certs).build();
return request.mutate().sslInfo(sslInfo).build();

The attributes look more-less like back-compatibility with Servlets, but do not forget these attributes are not the same as on the request level (see https://github.com/zowe/api-layer/blob/2ce6e5bb44f5862a1fe91a6a4cd8398aff6f7a08/gateway-service/src/main/java/org/zowe/apiml/gateway/filters/RequestAttributesProvider.java).

I am not sure if this is the best way to handle client certificates now. Maybe we should think about a custom implementation of SslInfo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Out of ignorance here, you are claiming they are not the same, however by tests it seems they are set. Can you explain the differences? What are the pitfalls of the current implementation?

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sensitive Sensitive change that requires peer review size/XXL
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants