pub struct Credentials {
    pub client_id: String,
    pub access_token: String,
    pub certificate: Option<String>,
}
Expand description

Credentials represents the set of credentials required to access protected Taskcluster HTTP APIs.

Fields

client_id: String

Client ID

access_token: String

Access token

certificate: Option<String>

Certificate for temporary credentials

Implementations

Create a new Credentials object from environment variables:

  • TASKCLUSTER_CLIENT_ID
  • TASKCLUSTER_ACCESS_TOKEN
  • TASKCLUSTER_CERTIFICATE (optional)

Create a new Credentials object with clientId and accessToken

Examples:

let _ = Credentials::new("my_client_id", "my_access_token");

Create a new Credentials object with clientId, accessToken, and certificate

Examples:

let _ = Credentials::new_with_certificate("my_client_id", "my_access_token", "{}");

Generate temporary credentials from permanent credentials, valid for the given duration, starting immediately. The temporary credentials’ scopes must be a subset of the permanent credentials’ scopes. The duration may not be more than 31 days. Any authorized scopes of the permanent credentials will be passed through as authorized scopes to the temporary credentials, but will not be restricted via the certificate.

Note that the auth service already applies a 5 minute clock skew to the start and expiry times in https://github.com/taskcluster/taskcluster-auth/pull/117 so no clock skew is applied in this method, nor should be applied by the caller.

See https://docs.taskcluster.net/docs/manual/design/apis/hawk/temporary-credentials

Similar to create_named_temp_creds, but creating unnamed credentials. This approach is still supported but users are encouraged to create named credentials when possible to support auditability.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more