Title: | Provides User Tokens for Access to ICES Web Services |
---|---|
Description: | Provides user tokens for ICES web services that require authentication and authorization. Web services covered by this package are ICES VMS database, the ICES DATSU web services, and the ICES SharePoint site. |
Authors: | Colin Millar [aut, cre] |
Maintainer: | Colin Millar <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2024-11-14 02:57:58 UTC |
Source: | https://github.com/cran/icesConnect |
Deletes the token from the key ring.
clear_token(username = getOption("ices.username"))
clear_token(username = getOption("ices.username"))
username |
the ices username that you require a token for, Default: getOption("ices.username") |
no return value
## Not run: clear_token() ## End(Not run)
## Not run: clear_token() ## End(Not run)
Decodes the token to allow inspection of claims
Return the expiration date of the token
What user is this token for
decode_token(jwt = ices_token(), formatted = TRUE) token_expiration(jwt = ices_token()) token_user(jwt = ices_token())
decode_token(jwt = ices_token(), formatted = TRUE) token_expiration(jwt = ices_token()) token_user(jwt = ices_token())
jwt |
a javascript web token got by running |
formatted |
should formatted output be returned |
list of claims
POSIXct date time
string, user name
## Not run: decode_token() ## End(Not run) ## Not run: token_expiration() ## End(Not run) ## Not run: token_user() ## End(Not run)
## Not run: decode_token() ## End(Not run) ## Not run: token_expiration() ## End(Not run) ## Not run: token_user() ## End(Not run)
Perform a get request to a url using a javascript web token for authentication
ices_get_jwt( url, username = NULL, retry = TRUE, quiet = FALSE, verbose = FALSE, jwt = NULL ) ices_post_jwt( url, body = list(), encode = "json", username = NULL, retry = TRUE, quiet = FALSE, verbose = FALSE, jwt = NULL ) ices_patch_jwt( url, body = list(), encode = "json", username = NULL, retry = TRUE, quiet = FALSE, verbose = FALSE, jwt = NULL ) ices_request_jwt( type = c("GET", "POST", "PATCH"), url, body = NULL, encode = c("multipart", "form", "json", "raw"), username = NULL, retry = TRUE, quiet = FALSE, verbose = FALSE, jwt = NULL )
ices_get_jwt( url, username = NULL, retry = TRUE, quiet = FALSE, verbose = FALSE, jwt = NULL ) ices_post_jwt( url, body = list(), encode = "json", username = NULL, retry = TRUE, quiet = FALSE, verbose = FALSE, jwt = NULL ) ices_patch_jwt( url, body = list(), encode = "json", username = NULL, retry = TRUE, quiet = FALSE, verbose = FALSE, jwt = NULL ) ices_request_jwt( type = c("GET", "POST", "PATCH"), url, body = NULL, encode = c("multipart", "form", "json", "raw"), username = NULL, retry = TRUE, quiet = FALSE, verbose = FALSE, jwt = NULL )
url |
the url to make the request to |
username |
the ices username to perform the request as, Default: getOption("ices.username") |
retry |
if initial request fails, should a retry be made, Default: TRUE |
quiet |
suppress informative messages to the console |
verbose |
should the http request return verbose output |
jwt |
option to supply a token bypassing the ices_token() route, if "" no token is used |
body |
optional body of request |
encode |
If the body is a named list, how should it be encoded? |
type |
the type of request to make, GET, POST or PATCH |
httr response object
ices_token
GET
,add_headers
,stop_for_status
,status_code
## Not run: # this function is interactive and asks the user for a password ices_request_jwt("GET", "https://taf.ices.dk/vms/api/gearwidths") ices_get_jwt("https://taf.ices.dk/vms/api/gearwidths") ## End(Not run)
## Not run: # this function is interactive and asks the user for a password ices_request_jwt("GET", "https://taf.ices.dk/vms/api/gearwidths") ices_get_jwt("https://taf.ices.dk/vms/api/gearwidths") ## End(Not run)
Stores a user token in the system keyring
ices_token(username = NULL, password = NULL, refresh = FALSE, ...)
ices_token(username = NULL, password = NULL, refresh = FALSE, ...)
username |
the ices username that you require a token for, Default: NULL, which results in getOption("ices.username") |
password |
the ices username that you require a token for, Default: NULL, which results in a dialogue box request for the password |
refresh |
should the token be refreshed to update new claims for example |
... |
not yet used |
character scalar, the token
## Not run: ices_token() ## End(Not run)
## Not run: ices_token() ## End(Not run)
Set the ICES user or logon name that will be used for requests
set_username(username)
set_username(username)
username |
the ices username you use to login to SharePoint for example. |
To set this permanently, add the line:
options(ices.username = "your ices user name")
to your '.Rprofile' file, see, usually '~/.Rprofile', see
Startup
for more information.
invisible value: the previous username that was set
set_username("myusername")
set_username("myusername")