move authtype check into token code

This commit is contained in:
hong-revo 2018-05-07 12:33:29 +10:00
Родитель 2335b1c476
Коммит f794977fc5
2 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -92,8 +92,9 @@ private=list(
#' @export
get_azure_token=function(aad_host, tenant, app, auth_type, secret, arm_host)
get_azure_token=function(aad_host, tenant, app, auth_type=c("client credentials", "device code"), secret, arm_host)
{
auth_type <- match.arg(auth_type)
base_url <- file.path(aad_host, tenant, fsep="/")
if(auth_type == "client credentials")
auth_with_creds(base_url, app, secret, arm_host)

Просмотреть файл

@ -9,7 +9,7 @@ public=list(
token=NULL,
# authenticate and get subscriptions
initialize=function(tenant, app, auth_type=c("client credentials", "device code"), secret,
initialize=function(tenant, app, auth_type="client credentials", secret,
host="https://management.azure.com/", aad_host="https://login.microsoftonline.com/",
config_file=NULL)
{
@ -26,7 +26,7 @@ public=list(
self$host <- host
self$tenant <- tenant
self$token <- get_azure_token(aad_host, tenant, app, match.arg(auth_type), secret, host)
self$token <- get_azure_token(aad_host, tenant, app, auth_type, secret, host)
NULL
},