Skip to content

feat: allow api key for cavern user allocation access#256

Merged
pdowler merged 14 commits intoopencadc:mainfrom
at88mph:user-allocation
Aug 22, 2025
Merged

feat: allow api key for cavern user allocation access#256
pdowler merged 14 commits intoopencadc:mainfrom
at88mph:user-allocation

Conversation

@at88mph
Copy link
Member

@at88mph at88mph commented Jul 18, 2025

Description

Allow an api-key Authorization header when performing a User Allocation administrative task. Also ensure a default quota is set on new allocations.

Changes

  • Log grant (client application) that requested use of API Key
  • Expose new configuration from the NodePersistence for caller checking
  • Assume root node owner for calls to directory creation when authenticated with API key.

@at88mph
Copy link
Member Author

at88mph commented Jul 21, 2025

Depends on opencadc/ac.git PR #181

@at88mph
Copy link
Member Author

at88mph commented Aug 14, 2025

Rework is ready for review. No changes needed to cadc-vos-server anymore. Note that the grant is logged differently as well.


// must be hard coded to this and not set via java system properties
this.identityManager = new PosixIdentityManager();
final IdentityManager configuredIdentityManager = AuthenticationUtil.getIdentityManager();
Copy link
Member

Choose a reason for hiding this comment

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

This is simply a check that init did the setup correctly. The error should not be exposed to operators as a failure here is a bug, not a config issue. Instead: just catch the possible ClasscastException at line 172, eg:

try {
    this.identityManager = (PosixIdentityManager) AuthenticationUtil.getIdentityManager();
} catch (ClasscastException ex) {
    throw new RuntimeException("BUG: init failed to wrap IdentityManager with PosixIdentityManager", ex);
}

Yeah, I literally put "BUG" in the error message :-)


@Override
public void doInit() {
initIdentityManager();
Copy link
Member

Choose a reason for hiding this comment

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

initIdentityManager needs to be called after initNodePersistence because it needs a value of jndiNodePersistence

@pdowler pdowler merged commit 7086070 into opencadc:main Aug 22, 2025
1 check passed
@at88mph at88mph deleted the user-allocation branch August 22, 2025 16:41
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