Skip to content

Machine account login - #1786

Open
JamesDoingStuff wants to merge 5 commits into
mainfrom
jg/machine-account-login
Open

JamesDoingStuff wants to merge 5 commits into
mainfrom
jg/machine-account-login

Conversation

@JamesDoingStuff

Copy link
Copy Markdown
Collaborator

AP-1378

Notes

  • Moved TokenValidator from graph-proxy to auth-core to allow reuse
  • Haven''t added tests as this feature is a stop-gap until auth rework
  • Behaviour is that user runs workflows service-login --client-id <ID> --client-secret <SECRET>, which is then posted along with the user's auth token to workflows.diamond.ac.uk/auth/client-creds. The user's token is validated, then the client creds are used to retrieve a refresh token to be stored in the database

@JamesDoingStuff JamesDoingStuff self-assigned this Oct 30, 2026
@JamesDoingStuff
JamesDoingStuff requested a review from a team October 30, 2026 11:34
}
};

let client = OidcClient::from_provider_metadata(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This requires the client to send their secret to auth-gateway.

I would move this logic to the CLI. Let the CLI acquire the refresh_token locally on the users machine. Then send the refresh_token to the auth-gateway server. This means that we never need to see their client secret.

Auth gateway should just validate that the access token used for the request is valid.

&token_response,
IssuerUrl::new(claims.iss)
.map_err(|_| AppError::new_500("Could not convert iss claim to URL".to_string()))?,
SubjectIdentifier::new(claims.sub),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you implement the above comment (get refresh token on the client side, send the refresh_token)

Use the subject from the access_token sent with the graph QL mutation. That guarantees we are updating the database entry that belongs to the user/client that made the query.

.bearer_auth(token.secret())
.json(&json!({
"client_id": args.client_id,
"client_secret": args.client_secret,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

see comments about moving oauth dance to CLI and send token instead

This branch has not been deployed

No deployments
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