Skip to main content

Crate composer_auth

Crate composer_auth 

Source
Expand description

Composer repository credentials, without an HTTP client.

AuthCredentials is one host’s credential and renders the header Composer sends for it; parse_auth_object reads Composer’s auth shape (top level of auth.json and COMPOSER_AUTH, config in composer.json) into a map keyed by host; auth_key is the key a URL is looked up under. Reading files and the environment is left to the caller.

Structs§

AuthError
A malformed auth document. The message names where the value came from and the offending key path, never a secret.

Enums§

AuthCredentials
One repository host’s credential. Debug never shows the secret.

Functions§

auth_key
The key a URL’s credential is looked up under, as Composer does: the host, with its port when the URL has one (repo.magento.com, 127.0.0.1:8080). Userinfo is dropped. None when there is no host (file:// URLs, paths).
parse_auth_json
Parse an auth.json document (or the COMPOSER_AUTH value). Empty or whitespace-only input is no credentials. source names the document in error messages.
parse_auth_object
Parse Composer’s auth object — {http-basic, bearer, github-oauth, gitlab-token, gitlab-oauth}, each a map from host to credential — into a map keyed by host. Other keys are ignored, so composer.json’s whole config block can be passed. source prefixes each error message.