Posit Package Manager single sign-on (SSO) authentication
Value
ppm_sso_login() returns the obtained token invisibly.
ppm_sso_logout() does not return anything.
ppm_sso_status() returns a list with the following components:
ppm_url: The URL of the Package Manager instance.token_file: The path of the cached token file.token: The cached token (partially masked for display) orNAif no token is found locally.valid:TRUEif the token is valid (only ifconnect = TRUE),FALSEif invalid, orNAif not checked.issuer: The issuer of the token, orNAif not available.subject: The subject of the token, orNAif not available.audience: The audience of the token, orNAif not available.issued_at: The issue time of the token as a POSIXct object, orNAif not available.expires_at: The expiration time of the token as a POSIXct object, orNAif not available.expired:TRUEif the token is expired,FALSEif not expired, orNAif expiration time is not available.expires_in: The time until expiration as a difftime object, orNAif expiration time is not available or the token is already expired.
Details
Set up SSO authentication:
Set the
PACKAGEMANAGER_ADDRESSenvironment variable to the URL of your RStudio Package Manager instance. For example, add this line to your.Renvironfile:Alternatively, you can also set it in your shell profile on Unix, or in the System or User environment variables on Windows.
Set
options(repos)to include a repository from your Package Manager instance. Include__token__as the username in the URL. For example:You probably want to add this to your
.Rprofilefile, so that it is set in every R session.Call
repo_get()to trigger authentication and caching of the token. You should be prompted to log in via your browser, and the obtained token will be cached for future use. Callppm_sso_status()to check the status of your authentication, including the path of the cached token and its expiration time.Alternatively, you can call
ppm_sso_login()directly to trigger the login process directly.
ppm_sso_login() initiates the SSO login process. You should be
prompted to log in via your browser, and the obtained token will be
cached for future use.
ppm_sso_logout() removes the cached token, effectively logging you
out. If there is no cached token, it does nothing.
ppm_sso_status() checks the status of your authentication, including
the path of the cached token and its expiration time.
Examples
if (FALSE) {
Sys.setenv(PACKAGEMANAGER_ADDRESS = "https://<ppm-url>")
options(repos = c(
PPM = "https://__token__@<ppm-url>/<repo-path>",
getOption("repos")
))
ppm_sso_login()
ppm_sso_status()
ppm_sso_status(connect = TRUE)
ppm_sso_logout()
}