22# '
33# ' Create an Azure token object from a pre-existing access token string. This is useful
44# ' when you have obtained a token externally (e.g., via Azure CLI, Python, or another
5- # ' authentication mechanism) and want to use it with the AzureR ecosystem.
5+ # ' authentication mechanism) and want to use it with the AzureR ecosystem. Rather than
6+ # ' calling the new() method directly, tokens should be created via [get_manual_token()].
67# '
78# ' @docType class
89# ' @section Methods:
9- # ' \itemize{
10- # ' \item \code{new(token, type, tenant, resource)}: Initialize a new manual token object .
11- # ' \item \code{refresh()}: Cannot refresh a manual token; issues a warning and returns self.
12- # ' \item \code{validate()}: Checks if the token has expired based on JWT claims .
13- # ' \item \code{ can_refresh()}: Returns FALSE since manual tokens cannot be refreshed .
14- # ' \item \code{ cache()}: No-op; manual tokens are not cached.
15- # ' }
10+ # '
11+ # ' This section documents how the methods for manual tokens differ from other token objects .
12+ # '
13+ # ' - `refresh`: Manual tokens cannot be refreshed; you must create a new token object .
14+ # ' - ` can_refresh`: Always returns FALSE for manual tokens.
15+ # ' - ` cache`: Manual tokens are not cached; this method does nothing .
16+ # ' - `hash`: The hash is based on the token string itself, rather than the R-level metadata.
1617# '
1718# ' @details
1819# ' The \code{AzureManualToken} class provides a way to wrap an externally-obtained access
@@ -58,11 +59,6 @@ AzureManualToken <- R6::R6Class("AzureManualToken", inherit = AzureToken,
5859
5960public = list (
6061
61- # ' @description Initialize a manual token from a raw access token string.
62- # ' @param token A character string containing the access token.
63- # ' @param type The token type, usually "Bearer".
64- # ' @param tenant Optional tenant ID. If NULL, extracted from JWT claims.
65- # ' @param resource Optional resource/audience. If NULL, extracted from JWT claims.
6662 initialize = function (token , type = " Bearer" , tenant = NULL , resource = NULL )
6763 {
6864 if (missing(token ) || is.null(token ) || ! is.character(token ) || nchar(token ) == 0 )
@@ -173,30 +169,22 @@ public = list(
173169 invisible (self )
174170 },
175171
176- # ' @description Refresh the token. Manual tokens cannot be refreshed.
177- # ' @return Returns self invisibly.
178172 refresh = function ()
179173 {
180174 invisible (self )
181175 },
182176
183- # ' @description Check if this token can be refreshed.
184- # ' @return Always returns FALSE for manual tokens.
185177 can_refresh = function ()
186178 {
187179 FALSE
188180 },
189181
190- # ' @description Cache the token. Manual tokens are not cached.
191- # ' @return Returns NULL invisibly.
192182 cache = function ()
193183 {
194184 # Do not cache manual tokens - they are managed externally
195185 invisible (NULL )
196186 },
197187
198- # ' @description Compute a hash for this token.
199- # ' @return An MD5 hash string based on the token content.
200188 hash = function ()
201189 {
202190 # Hash based on the token string itself
@@ -209,7 +197,6 @@ public = list(
209197 paste(openssl :: md5(msg [- (1 : 14 )]), collapse = " " )
210198 },
211199
212- # ' @description Print the token object.
213200 print = function ()
214201 {
215202 cat(format_auth_header(self ))
0 commit comments