VEuPathDB / lib-jaxrs-container-core

Core library for VEuPathDB JaxRS container services
Apache License 2.0
0 stars 0 forks source link

Add RequestAuth type to replace `Map.Entry` usage. #19

Closed Foxcapades closed 2 years ago

Foxcapades commented 2 years ago

Change

Added the concrete type RequestAuth to represent the request authentication header/info as an alternative to passing around a raw Map.Entry instance.

The new type presently implements Map.Entry itself to ease the change over from using that type. This is temporary and should be removed by v8 (or a later major release).

Reasoning

The usage of Map.Entry instead of a new or alternative type for this is abusing a type internal to Map for reasons that are unrelated to the defined purpose of the type.

Additionally, there are few to no available standard library implementations of the Map.Entry interface that are not part of or included within a Map implementation (most of which are private or package-private), meaning consumers of this library will also need to rely on code from an additional library (FgpUtil) or implement Map.Entry themselves.

Impact on Library Consumers

While this is technically a "breaking change" the new type implements Map.Entry so most if not all consumers of this library will be unaffected by the update. Consumers of this library should update their calls to UserProvider.getSubmittedAuth to declare the type RequestAuth instead of Map.Entry type as the new type RequestAuth will be updated in the future to no longer implement Map.Entry.

Foxcapades commented 2 years ago

@ryanrdoherty

even though EDACommon does not depend on container core

I didn't realize EDA Common doesn't depend on this project.

Perhaps, since FgpUtil is a common dependency here, then we should use an FgpUtil tuple type instead of a new type in Container Core?

Frustrating that Java doesn't have any tuple types in the standard library.

Foxcapades commented 2 years ago

Rejecting based on discussion had around this in scrum.