зеркало из https://github.com/Azure/AzureRMR.git
rm token printing code
This commit is contained in:
Родитель
52dc74ba75
Коммит
76f4d70f29
|
@ -12,7 +12,6 @@ export(clean_token_directory)
|
|||
export(create_azure_login)
|
||||
export(delete_azure_login)
|
||||
export(delete_azure_token)
|
||||
export(format_auth_header)
|
||||
export(format_public_fields)
|
||||
export(format_public_methods)
|
||||
export(get_azure_login)
|
||||
|
|
31
R/format.R
31
R/format.R
|
@ -2,43 +2,12 @@
|
|||
#'
|
||||
#' Miscellaneous functions for printing Azure R6 objects
|
||||
#'
|
||||
#' @param token An Azure OAuth token.
|
||||
#' @param env An R6 object's environment for printing.
|
||||
#' @param exclude Objects in `env` to exclude from the printout.
|
||||
#'
|
||||
#' @details
|
||||
#' These functions are utilities to aid in printing Azure R6 objects. They are not meant to be called by the user.
|
||||
#'
|
||||
#' @rdname format
|
||||
#' @export
|
||||
format_auth_header <- function(token)
|
||||
{
|
||||
stopifnot(is_azure_token(token))
|
||||
expiry <- as.POSIXct(as.numeric(token$credentials$expires_on), origin="1970-01-01")
|
||||
obtained <- expiry - as.numeric(token$credentials$expires_in)
|
||||
resource <- token$credentials$resource
|
||||
tenant <- sub("/.+$", "", httr::parse_url(token$endpoint$access)$path)
|
||||
app <- token$app$key
|
||||
|
||||
auth_type <- if(token$params$client_credentials)
|
||||
"client_credentials"
|
||||
else if(token$params$use_device)
|
||||
"device_code"
|
||||
else if(!is.null(token$params$user_params$username))
|
||||
"resource_owner"
|
||||
else "authorization_code"
|
||||
|
||||
hash <- token$hash()
|
||||
|
||||
paste0("Azure Active Directory token for resource ", resource, "\n",
|
||||
" Tenant: ", tenant, "\n",
|
||||
" App ID: ", app, "\n",
|
||||
" Authentication method: ", auth_type, "\n",
|
||||
" Token valid from: ", format(obtained, usetz=TRUE), " to: ", format(expiry, usetz=TRUE), "\n",
|
||||
" MD5 hash of inputs: ", hash, "\n")
|
||||
}
|
||||
|
||||
|
||||
#' @rdname format
|
||||
#' @export
|
||||
format_public_fields <- function(env, exclude=character(0))
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/format.R
|
||||
\name{format_auth_header}
|
||||
\alias{format_auth_header}
|
||||
\name{format_public_fields}
|
||||
\alias{format_public_fields}
|
||||
\alias{format_public_methods}
|
||||
\title{Format an Azure object}
|
||||
\usage{
|
||||
format_auth_header(token)
|
||||
|
||||
format_public_fields(env, exclude = character(0))
|
||||
|
||||
format_public_methods(env)
|
||||
}
|
||||
\arguments{
|
||||
\item{token}{An Azure OAuth token.}
|
||||
|
||||
\item{env}{An R6 object's environment for printing.}
|
||||
|
||||
\item{exclude}{Objects in \code{env} to exclude from the printout.}
|
||||
|
|
Загрузка…
Ссылка в новой задаче