-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support for additional claims in the JWT tokens, needed for Google's Identity-Aware Proxy #570
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -301,6 +301,7 @@ Token2.0 <- R6::R6Class("Token2.0", inherit = Token, list( | |
#' @inheritParams oauth2.0_token | ||
#' @inheritParams jwt_signature | ||
#' @param secrets Secrets loaded from JSON file, downloaded from console. | ||
#' @param ... any additional claims for the token | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can remove this line since we're already inheriting docs from |
||
#' @family OAuth | ||
#' @export | ||
#' @examples | ||
|
@@ -311,7 +312,7 @@ Token2.0 <- R6::R6Class("Token2.0", inherit = Token, list( | |
#' | ||
#' token <- oauth_service_token(endpoint, secrets, scope) | ||
#' } | ||
oauth_service_token <- function(endpoint, secrets, scope = NULL, sub = NULL) { | ||
oauth_service_token <- function(endpoint, secrets, scope = NULL, sub = NULL, ...) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
if (!is.oauth_endpoint(endpoint)) { | ||
stop("`endpoint` must be an OAuth endpoint", call. = FALSE) | ||
} | ||
|
@@ -324,7 +325,7 @@ oauth_service_token <- function(endpoint, secrets, scope = NULL, sub = NULL) { | |
TokenServiceAccount$new( | ||
endpoint = endpoint, | ||
secrets = secrets, | ||
params = list(scope = scope, sub = sub) | ||
params = list(scope = scope, sub = sub, ...) | ||
) | ||
} | ||
|
||
|
@@ -343,16 +344,12 @@ TokenServiceAccount <- R6::R6Class("TokenServiceAccount", inherit = Token2.0, li | |
TRUE | ||
}, | ||
refresh = function() { | ||
self$credentials <- init_oauth_service_account( | ||
self$secrets, | ||
scope = self$params$scope, | ||
sub = self$params$sub | ||
) | ||
self$credentials <- do.call(init_oauth_service_account, c(list(secrets = self$secrets), self$params)) | ||
self | ||
}, | ||
sign = function(method, url) { | ||
config <- add_headers( | ||
Authorization = paste("Bearer", self$credentials$access_token) | ||
Authorization = paste("Bearer", self$credentials$access_token %||% self$credentials$id_token) | ||
) | ||
request_build(method = method, url = url, config) | ||
}, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.