-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add option in OAuthCred to load authUrlV2. #3777
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
Conversation
e74b6fa
to
4af9b2c
Compare
{ | ||
credData = migratedCred; | ||
|
||
// Re-write .credentials with Token URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the code left when we finish SPS->Token migration.
We still want to keep .credentials
and .credentials_migrated
for a while in this case.
@@ -51,21 +51,16 @@ public VssCredentials LoadCredentials() | |||
|
|||
CredentialData credData = store.GetCredentials(); | |||
var migratedCred = store.GetMigratedCredentials(); | |||
if (migratedCred != null) | |||
if (migratedCred != null && | |||
migratedCred.Scheme == Constants.Configuration.OAuth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hosted runner will have different auth schema.
@@ -197,6 +197,16 @@ private async Task UpdateRunnerCredentialsAsync(string serviceType, string confi | |||
await ReportTelemetryAsync($"Credential clientId in refreshed config '{refreshedClientId ?? "Empty"}' does not match the current credential clientId '{clientId}'."); | |||
return; | |||
} | |||
|
|||
// make sure the credential authorizationUrl in the refreshed config match the current credential authorizationUrl for OAuth auth scheme | |||
var authorizationUrl = _credData.Data.GetValueOrDefault("authorizationUrl", null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will make sure the .credentials_migrated
is identical with .credentials
for us to safely fallback.
4af9b2c
to
231f9e1
Compare
Here is the normally flow we auth with service today:
.credentials
file to create aVssCredential
objectVssCredential
toConnectAsync
for different server, ex: RunnerServer, BrokerServer, RunServer, ActionsRunServer, etc.The service will send down a newer version of the
.credentials
config that looks like the following:I am changing the runner.listener to realize there might be 2 types of
VssCredential
, one created withauthorizationUrl
, another created withauthorizationUrlV2
.Different
VssCredential
will be used forConnectAsync
for different server.authorizationUrl
authorizationUrl
authorizationUrlV2
authorizationUrlV2
This PR is not making real change of using
authorizationUrlV2
, since we passallowAuthUrlV2: false
in all the places we createVssCredential
viaVssCredentials GetVssCredentials(IHostContext context, bool allowAuthUrlV2);
https://github.com/github/actions-runner-admin/issues/1656