-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Move authentication logic out of config #409
Conversation
5a527fe
to
66726be
Compare
"https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/userinfo.email"; | ||
// Initialize ServiceAccountAccess so we can request later when needed. | ||
let info = gcloud_account_info()?; | ||
let access = ServiceAccountAccess::new(info).map_err(OAuthError::InvalidKeyFormat)?; |
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.
ServiceAccountAccess
has internal cache and returns Request
when it's necessary to refresh the token. See token
below.
66726be
to
d1dbe24
Compare
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.
merge away :-)
|
||
let mut value = HeaderValue::from_str(&format!("Bearer {}", &locked_data.0)) | ||
.map_err(ConfigError::InvalidBearerToken)?; | ||
value.set_sensitive(true); |
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.
Ah, good call.
91701dd
to
e5da843
Compare
6ee2b6e
to
080fe9b
Compare
Config should focus on finding and loading the configuration. Setting up auth and refreshing token is now handled by service.
Config is now free of
native-tls
/rustls-tls
except for the macOS hack.