![]() |
GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
|
Public Member Functions | |
| IAllowCredentialSettings | WithScope (OAuthScope scope) |
| Sets the OAuth scope to request when an access token is fetched. | |
| IAllowCredentialSettings | WithAuthCode (string authCode) |
| Supplies a previously-obtained OAuth authorization code, skipping the interactive authorization step. | |
| IAllowCredentialSettings | WithRefreshToken (string refreshToken) |
| Supplies a previously-obtained OAuth refresh token, used to fetch a new access token without re-authorizing. | |
| IAllowCredentialMethod | WithService (CredentialServiceType serviceType) |
| Selects which password manager or cloud identity service this credentials request targets. | |
| IAllowCredentialsPassword | WithUsername (string username) |
| Sets the username, either as a credential to retrieve directly (with CredentialServiceType.None) or as part of WithCredentials' master login. | |
| IAllowOAuthClient | WithPassword (string password) |
| Sets the password, either as a credential to retrieve directly (with CredentialServiceType.None) or as part of WithCredentials' master login. | |
| IAllowOAuthClient | WithWebAuth (WebAuthType webAuthType) |
| How the site expects to be told who you are. A browser handed this credential acts on it accordingly, so the workflow says what kind of door it is rather than how to open it. | |
| IAllowOAuthClient | WithAuthRedirectUrl (string redirectUrl) |
| Where the OAuth redirect lands, and therefore what has to catch the token. This is the one setting that is not GPAL's to choose: it has to be the URI registered with the provider, because that is the only place the provider will send the browser. Its authority is where GPAL listens, or where it expects to find a GPALRestAPI already listening. Defaults to whatever credentialsConfig.json holds, http://localhost:3000/access-token out of the box. | |
| IAllowOAuthClient | WithAccessToken (string accessToken) |
| A token the workflow already holds, for the schemes that present one: Bearer, X-Auth-Token, X-API-Key and api-key. The same field an OAuth fetch fills in, so a token that was read out of a page or handed over by someone else is presented exactly as one GPAL fetched would be. | |
| IAllowCredentialSettings | WithDomain (string domain) |
| Restricts GetCredentialsFor/SaveTo results to vault items whose URL contains this domain. If not called, no domain filtering is applied. | |
| IAllowClientSecret | WithClientId (string clientId) |
| Sets the OAuth client ID used to authenticate to ServiceType. | |
| IAllowCredentialSettings | WithClientSecret (string clientSecret) |
| Sets the OAuth client secret and derives ServiceKey as "ClientId:ClientSecret". | |
| IAllowCredentialSettings | WithServiceKey (string key) |
| Service key is a custom string consisting of your ClientID:ClientSecret. | |
| IAllowCredentialSettings | WithKeyFromEnv (string envVariableName) |
| Like WithServiceKey, but reads the key from an environment variable (checking process, user, then machine scope) instead of taking it as a literal string. | |
| IAllowKeyFromApiEndpoint | WithKeyFromApi (IRESTClient restClient) |
| Like WithServiceKey, but fetches the key via a GET request made with the supplied, already-configured RESTClient. Must be followed by .WithEndpoint(endpoint) to specify which endpoint returns the key, e.g. GPAL.CredentialsFor(CredentialServiceType.StaticKey).WithKeyFromApi(restClient).WithEndpoint("ANTKEY").ToGPALObject(). | |
| IAllowCredentialSettings | WithEndpoint (string endpoint) |
| Completes .WithKeyFromApi(restClient) by calling the given endpoint on that RESTClient and using the returned value as the service key (see WithServiceKey). | |
| IAllowCredentialSettings | WithServiceAccountKey (GPALFile serviceAccountKeyFile) |
| Loads a Google Cloud service account key from a JSON key file, used to fetch an access token without an interactive OAuth flow. | |
| IAllowCredentialSettings | WithServiceAccountKey (string serviceAccountKey) |
| Supplies a Google Cloud service account key as a raw JSON string, used to fetch an access token without an interactive OAuth flow. | |
| IAllowCredentialSettings | WithServiceAccountKey (GoogleServiceAccountKey serviceAccountKey) |
| Supplies a Google Cloud service account key as a deserialized object, used to fetch an access token without an interactive OAuth flow. | |
| IAllowCredentialSettings | WithMasterCredentials (ICredentials masterCredentials) |
| Supplies the login for the credential service itself, your Bitwarden, LastPass or 1Password account, instead of setting those fields on this request one call at a time. | |
| IAllowCredentialSettings | GetCredentialsFor (string target) |
| Sets the search term used to find a matching item in the target password manager (e.g. a site name or URL), and ensures an access token is available for ServiceType. | |
| IAllowGetCredentials | SaveTo (IGPALGrid< string > grid) |
| Looks up the credential matching .GetCredentialsFor's target (filtered by .WithDomain if set) and appends a [Username, Password] row to the given grid. Typical usage: .WithSelector(usernameSelector).WithSelector(passwordSelector).FillInFrom(grid).LeftClick(loginSelector). | |
| ICredentials | ToGPALObject () |
| Fluent interface to return this credentials object as an ICredentials. | |
| void | FetchAccessToken (out string accessToken) |
| Fetches a new access token for ServiceType using the credentials/configuration supplied so far, and stores it in AccessToken/IssueTime/ExpiresIn. | |
Properties | |
| string | Username [get] |
| Username supplied via .WithUsername, or the username field returned from a vault item. | |
| string | ServiceKey [get] |
| Combined "ClientId:ClientSecret" service key supplied via .WithServiceKey or derived from .WithClientId/.WithClientSecret. | |
| WebAuthType | WebAuthType [get] |
| How the site expects to be told who you are, supplied via .WithWebAuth. Read by a browser this credential is given to, which is what decides whether anything can be done before the first request. | |
| string | ClientId [get, set] |
| OAuth client ID supplied via .WithClientId or derived from .WithServiceKey. | |
| string | ClientSecret [get, set] |
| OAuth client secret supplied via .WithClientSecret or derived from .WithServiceKey. | |
| string | AccessToken [get, set] |
| Most recently fetched access token for ServiceType, set by FetchAccessToken/GetCredentialsFor. | |
| string | Target [get] |
| Search term supplied via GetCredentialsFor, used by the password manager handlers to find a matching vault item. | |
| string | Domain [get] |
| Optional URL filter supplied via .WithDomain, used to narrow vault matches down to a specific site. | |
| CredentialsConfig | Config [get] |
| Endpoint/protocol configuration for the credential service handlers, loaded from ./credentialsConfig.json. | |
| string | AuthCode [get, set] |
| OAuth authorization code supplied via .WithAuthCode, or retrieved automatically during the OAuth redirect flow. | |
| string | RefreshToken [get, set] |
| OAuth refresh token supplied via .WithRefreshToken, or returned by a token exchange and used to renew AccessToken. | |
| OAuthScope | OAuthScope [get, set] |
| OAuth scope requested via .WithScope when fetching an access token. | |
Definition at line 639 of file Credentials.cs.
| void GenerallyPositive.Credentials.FetchAccessToken | ( | out string | accessToken | ) |
Fetches a new access token for ServiceType using the credentials/configuration supplied so far, and stores it in AccessToken/IssueTime/ExpiresIn.
| accessToken | Receives the fetched access token, or an empty string if the fetch failed or ServiceType has no token fetcher. |
Implements GenerallyPositive.IAllowGetCredentials.
Definition at line 1231 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.GetCredentialsFor | ( | string | target | ) |
Sets the search term used to find a matching item in the target password manager (e.g. a site name or URL), and ensures an access token is available for ServiceType.
| target | Search term identifying the vault item to retrieve. |
Implements GenerallyPositive.IAllowCredentialSettings.
Definition at line 1171 of file Credentials.cs.
| IAllowGetCredentials GenerallyPositive.Credentials.SaveTo | ( | IGPALGrid< string > | grid | ) |
Looks up the credential matching .GetCredentialsFor's target (filtered by .WithDomain if set) and appends a [Username, Password] row to the given grid.
Typical usage: .WithSelector(usernameSelector).WithSelector(passwordSelector).FillInFrom(grid).LeftClick(loginSelector).
| grid | Grid to append the retrieved [Username, Password] row to. |
Implements GenerallyPositive.IAllowCredentialSettings.
Definition at line 1187 of file Credentials.cs.
| ICredentials GenerallyPositive.Credentials.ToGPALObject | ( | ) |
Fluent interface to return this credentials object as an ICredentials.
Implements GenerallyPositive.IAllowToGPALObject< TResult >.
Definition at line 1222 of file Credentials.cs.
| IAllowOAuthClient GenerallyPositive.Credentials.WithAccessToken | ( | string | accessToken | ) |
A token the workflow already holds, for the schemes that present one: Bearer, X-Auth-Token, X-API-Key and api-key.
The same field an OAuth fetch fills in, so a token that was read out of a page or handed over by someone else is presented exactly as one GPAL fetched would be.
| accessToken | The token, as the site issued it and with no scheme word in front of it |
Implements GenerallyPositive.IAllowOAuthClient.
Definition at line 948 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithAuthCode | ( | string | authCode | ) |
Supplies a previously-obtained OAuth authorization code, skipping the interactive authorization step.
| authCode | Authorization code returned by the OAuth provider's consent screen. |
Implements GenerallyPositive.IAllowCredentialSettings.
Definition at line 858 of file Credentials.cs.
| IAllowOAuthClient GenerallyPositive.Credentials.WithAuthRedirectUrl | ( | string | redirectUrl | ) |
Where the OAuth redirect lands, and therefore what has to catch the token. This is the one setting that is not GPAL's to choose: it has to be the URI registered with the provider, because that is the only place the provider will send the browser. Its authority is where GPAL listens, or where it expects to find a GPALRestAPI already listening.
Defaults to whatever credentialsConfig.json holds, http://localhost:3000/access-token out of the box.
| redirectUrl | The redirect URI as registered with the provider, e.g. http://localhost:3117/access-token |
Implements GenerallyPositive.IAllowOAuthClient.
Definition at line 934 of file Credentials.cs.
| IAllowClientSecret GenerallyPositive.Credentials.WithClientId | ( | string | clientId | ) |
Sets the OAuth client ID used to authenticate to ServiceType.
| clientId | OAuth client ID. |
Implements GenerallyPositive.IAllowClientId.
Definition at line 969 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithClientSecret | ( | string | clientSecret | ) |
Sets the OAuth client secret and derives ServiceKey as "ClientId:ClientSecret".
| clientSecret | OAuth client secret. |
Implements GenerallyPositive.IAllowClientSecret.
Definition at line 979 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithDomain | ( | string | domain | ) |
Restricts GetCredentialsFor/SaveTo results to vault items whose URL contains this domain. If not called, no domain filtering is applied.
| domain | Domain or URL fragment to match against vault item URLs. |
Implements GenerallyPositive.IAllowCredentialSettings.
Definition at line 959 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithEndpoint | ( | string | endpoint | ) |
Completes .WithKeyFromApi(restClient) by calling the given endpoint on that RESTClient and using the returned value as the service key (see WithServiceKey).
| endpoint | REST endpoint name to call for the key, e.g. "ANTKEY". |
Implements GenerallyPositive.IAllowKeyFromApiEndpoint.
Definition at line 1043 of file Credentials.cs.
| IAllowKeyFromApiEndpoint GenerallyPositive.Credentials.WithKeyFromApi | ( | IRESTClient | restClient | ) |
Like WithServiceKey, but fetches the key via a GET request made with the supplied, already-configured RESTClient. Must be followed by .WithEndpoint(endpoint) to specify which endpoint returns the key, e.g. GPAL.CredentialsFor(CredentialServiceType.StaticKey).WithKeyFromApi(restClient).WithEndpoint("ANTKEY").ToGPALObject().
| restClient | Already-configured RESTClient (e.g. via .WithAPIBase(...)) used to fetch the key. |
Implements GenerallyPositive.IAllowUsernameOrKey.
Definition at line 1031 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithKeyFromEnv | ( | string | envVariableName | ) |
Like WithServiceKey, but reads the key from an environment variable (checking process, user, then machine scope) instead of taking it as a literal string.
| envVariableName | Name of the environment variable holding the API key. |
Implements GenerallyPositive.IAllowUsernameOrKey.
Definition at line 1005 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithMasterCredentials | ( | ICredentials | masterCredentials | ) |
Supplies the login for the credential service itself, your Bitwarden, LastPass or 1Password account, instead of setting those fields on this request one call at a time.
Only the authentication fields are taken. Which vault is queried is still whatever WithService named, so one master login built once serves every lookup against every service.
This is not the WithCredentials that a browser, a mail server or GPAL.YouTube takes. Those are handed a credential to use. This one is handed the credential that opens the vault.
| masterCredentials | A credentials object already holding the login for the service |
Implements GenerallyPositive.IAllowCredentialMethod.
Definition at line 1148 of file Credentials.cs.
| IAllowOAuthClient GenerallyPositive.Credentials.WithPassword | ( | string | password | ) |
Sets the password, either as a credential to retrieve directly (with CredentialServiceType.None) or as part of WithCredentials' master login.
| password | Password value. |
Implements GenerallyPositive.IAllowCredentialsPassword.
Definition at line 907 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithRefreshToken | ( | string | refreshToken | ) |
Supplies a previously-obtained OAuth refresh token, used to fetch a new access token without re-authorizing.
| refreshToken | Refresh token returned by a prior token exchange. |
Implements GenerallyPositive.IAllowCredentialSettings.
Definition at line 868 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithScope | ( | OAuthScope | scope | ) |
Sets the OAuth scope to request when an access token is fetched.
| scope | Scope to request. |
Implements GenerallyPositive.IAllowCredentialSettings.
Definition at line 848 of file Credentials.cs.
| IAllowCredentialMethod GenerallyPositive.Credentials.WithService | ( | CredentialServiceType | serviceType | ) |
Selects which password manager or cloud identity service this credentials request targets.
| serviceType | Service to query/store credentials with, or CredentialServiceType.None for username/password supplied directly. |
Implements GenerallyPositive.IAllowCredentialServiceType.
Definition at line 885 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithServiceAccountKey | ( | GoogleServiceAccountKey | serviceAccountKey | ) |
Supplies a Google Cloud service account key as a deserialized object, used to fetch an access token without an interactive OAuth flow.
| serviceAccountKey | Service account key object, normally loaded from a JSON key file. |
Implements GenerallyPositive.IAllowClientId.
Definition at line 1109 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithServiceAccountKey | ( | GPALFile | serviceAccountKeyFile | ) |
Loads a Google Cloud service account key from a JSON key file, used to fetch an access token without an interactive OAuth flow.
| serviceAccountKeyFile | GPALFile pointing at the service account JSON key file. |
Implements GenerallyPositive.IAllowClientId.
Definition at line 1067 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithServiceAccountKey | ( | string | serviceAccountKey | ) |
Supplies a Google Cloud service account key as a raw JSON string, used to fetch an access token without an interactive OAuth flow.
| serviceAccountKey | Service account key JSON contents. |
Implements GenerallyPositive.IAllowClientId.
Definition at line 1088 of file Credentials.cs.
| IAllowCredentialSettings GenerallyPositive.Credentials.WithServiceKey | ( | string | key | ) |
Service key is a custom string consisting of your ClientID:ClientSecret.
| key | Combined "ClientId:ClientSecret" service key. |
Implements GenerallyPositive.IAllowUsernameOrKey.
Definition at line 990 of file Credentials.cs.
| IAllowCredentialsPassword GenerallyPositive.Credentials.WithUsername | ( | string | username | ) |
Sets the username, either as a credential to retrieve directly (with CredentialServiceType.None) or as part of WithCredentials' master login.
| username | Username/login value. |
Implements GenerallyPositive.IAllowUsernameOrKey.
Definition at line 896 of file Credentials.cs.
| IAllowOAuthClient GenerallyPositive.Credentials.WithWebAuth | ( | WebAuthType | webAuthType | ) |
How the site expects to be told who you are. A browser handed this credential acts on it accordingly, so the workflow says what kind of door it is rather than how to open it.
| webAuthType | Basic, Digest, Proxy, Bearer, or Form when the credential is only being held for a login page the workflow drives itself |
Implements GenerallyPositive.IAllowOAuthClient.
Definition at line 919 of file Credentials.cs.
|
getset |
Most recently fetched access token for ServiceType, set by FetchAccessToken/GetCredentialsFor.
Definition at line 677 of file Credentials.cs.
|
getset |
OAuth authorization code supplied via .WithAuthCode, or retrieved automatically during the OAuth redirect flow.
Definition at line 693 of file Credentials.cs.
|
getset |
OAuth client ID supplied via .WithClientId or derived from .WithServiceKey.
Definition at line 669 of file Credentials.cs.
|
getset |
OAuth client secret supplied via .WithClientSecret or derived from .WithServiceKey.
Definition at line 673 of file Credentials.cs.
|
get |
Endpoint/protocol configuration for the credential service handlers, loaded from ./credentialsConfig.json.
Definition at line 689 of file Credentials.cs.
|
get |
Optional URL filter supplied via .WithDomain, used to narrow vault matches down to a specific site.
Definition at line 685 of file Credentials.cs.
|
getset |
OAuth scope requested via .WithScope when fetching an access token.
Definition at line 701 of file Credentials.cs.
|
getset |
OAuth refresh token supplied via .WithRefreshToken, or returned by a token exchange and used to renew AccessToken.
Definition at line 697 of file Credentials.cs.
|
get |
Combined "ClientId:ClientSecret" service key supplied via .WithServiceKey or derived from .WithClientId/.WithClientSecret.
Definition at line 656 of file Credentials.cs.
|
get |
Search term supplied via GetCredentialsFor, used by the password manager handlers to find a matching vault item.
Definition at line 681 of file Credentials.cs.
|
get |
Username supplied via .WithUsername, or the username field returned from a vault item.
Definition at line 648 of file Credentials.cs.
|
get |
How the site expects to be told who you are, supplied via .WithWebAuth. Read by a browser this credential is given to, which is what decides whether anything can be done before the first request.
Definition at line 661 of file Credentials.cs.