Skip to content

PD-5278#7495

Merged
amontenegro merged 4 commits intomainfrom
lmendoza/PD-5278
Apr 6, 2026
Merged

PD-5278#7495
amontenegro merged 4 commits intomainfrom
lmendoza/PD-5278

Conversation

@cryptalith
Copy link
Copy Markdown
Member

No description provided.

@amontenegro
Copy link
Copy Markdown
Member

@@ -1,4 +1,4 @@
package org.orcid.api.publicV3.server.security.impl;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @cryptalith why did you moved this class from the pub api package? you moved it to the orcid-core lib so any other env will now have access to it, which is not ideal

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Moved the interface and implementation back under the public v3 security package, but placed them in orcid-api-common so both registry web and public API can share the same visibility-filtering logic without orcid-web depending on the orcid-pub-web WAR

@@ -1,4 +1,4 @@
package org.orcid.api.publicV3.server.security;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @cryptalith why did you moved this class from the pub api package? you moved it to the orcid-core lib so any other env will now have access to it, which is not ideal

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Answered in the previous thread.


<bean id="orcidCoreExceptionMapper" class="org.orcid.core.exception.OrcidCoreExceptionMapper" />

<bean id="publicAPISecurityManagerV3" class="org.orcid.core.api.publicapi.v3.security.impl.PublicAPISecurityManagerV3Impl" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you dont need this bean here, where are you using it and why do you need it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As mentioned in the previous thread, publicAPISecurityManagerV3 is now removed from core, so I am also removing this.

private PublicRecordUtils() {
}

public static Record getPublicRecord(String orcid, RecordManagerReadOnly recordManagerReadOnly, OrcidSecurityManager orcidSecurityManager,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @cryptalith , getPublicRecord should have only 2 params, the orcid and the boolean filterVersionOfIdentifiers, then, all the beans that are used to generate and validate the data should be @resources of this class.

Annotate the class definition with @Component and that will be enought to make the @Resource work

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done. PublicRecordUtils is now a @component

import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice(assignableTypes = PublicRecordApiController.class)
public class PublicRecordApiExceptionHandler {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@cryptalith did you tested that this code runs? Im not sure if this code is necessary or not.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, this can be tested by navigating to a deprecated orcid id print page.

As the PublicRecordApiController is a Spring MVC @controller. Requests to /{orcid}/record are handled by Spring’s not by the JAX-RS stack where OrcidExceptionMapper run for the public API.

So for this endpoint the @RestControllerAdvice is the Spring-side equivalent: it turns exceptions from that controller only into HTTP responses.

@amontenegro amontenegro merged commit ae23c63 into main Apr 6, 2026
16 checks passed
@amontenegro amontenegro deleted the lmendoza/PD-5278 branch April 6, 2026 23:26
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.

2 participants