![]() |
GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
|
Public Member Functions | |
| IAllowCredentialsIntoCredentials | WithScope (OAuthScope scope) |
| Sets the OAuth scope to request when an access token is fetched. | |
| IAllowCredentialsIntoCredentials | WithAuthCode (string authCode) |
| Supplies a previously-obtained OAuth authorization code, skipping the interactive authorization step. | |
| IAllowCredentialsIntoCredentials | WithRefreshToken (string refreshToken) |
| Supplies a previously-obtained OAuth refresh token, used to fetch a new access token without re-authorizing. | |
| IAllowCredentialsUsername | 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. | |
| IAllowCredentialsServiceKeyWithCredentials | WithPassword (string password) |
| Sets the password, either as a credential to retrieve directly (with CredentialServiceType.None) or as part of WithCredentials' master login. | |
| IAllowCredentialsServiceKeyWithCredentials | 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. | |
| IAllowCredentialsServiceKeyWithCredentials | 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. | |
| IAllowCredentialsServiceKeyWithCredentials | 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. | |
| IAllowCredentialsIntoCredentials | 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. | |
| IAllowCredentialsIntoCredentials | WithClientSecret (string clientSecret) |
| Sets the OAuth client secret and derives ServiceKey as "ClientId:ClientSecret". | |
| IAllowCredentialsIntoCredentials | WithServiceKey (string key) |
| Service key is a custom string consisting of your ClientID:ClientSecret. | |
| IAllowCredentialsIntoCredentials | 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(). | |
| IAllowCredentialsIntoCredentials | 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). | |
| IAllowCredentialsIntoCredentials | 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. | |
| IAllowCredentialsIntoCredentials | 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. | |
| IAllowCredentialsIntoCredentials | 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. | |
| IAllowCredentialsIntoCredentials | 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. | |
| IAllowCredentialsIntoCredentials | WithCredentials (ICredentials credentials) |
| Supplies the login (master) credentials used to authenticate to the credential service itself (e.g. your Bitwarden/LastPass/1Password account), as an alternative to calling .WithUsername(...).WithPassword(...)/.WithClientId(...)/etc. directly. .WithService(serviceType) still determines which service/vault is queried by GetCredentialsFor/SaveTo; only the authentication fields are copied from credentials . | |
| 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 1223 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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.IAllowCredentialsIntoCredentials.
Definition at line 1137 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.IAllowCredentialsIntoCredentials.
Definition at line 1179 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 1214 of file Credentials.cs.
| IAllowCredentialsServiceKeyWithCredentials 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.IAllowCredentialsServiceKeyWithCredentials.
Definition at line 944 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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.IAllowCredentialsIntoCredentials.
Definition at line 854 of file Credentials.cs.
| IAllowCredentialsServiceKeyWithCredentials 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.IAllowCredentialsServiceKeyWithCredentials.
Definition at line 930 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 965 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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 975 of file Credentials.cs.
| IAllowCredentialsIntoCredentials GenerallyPositive.Credentials.WithCredentials | ( | ICredentials | credentials | ) |
Supplies the login (master) credentials used to authenticate to the credential service itself (e.g. your Bitwarden/LastPass/1Password account), as an alternative to calling .WithUsername(...).WithPassword(...)/.WithClientId(...)/etc. directly.
.WithService(serviceType) still determines which service/vault is queried by GetCredentialsFor/SaveTo; only the authentication fields are copied from credentials .
| credentials | Previously-built credentials (e.g. via GPAL.CredentialsFor(CredentialServiceType.None).WithUsername(...).WithPassword(...)) used to log in to the service named by .WithService |
Implements GenerallyPositive.IAllowCredentialsUsername.
Definition at line 1156 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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.IAllowCredentialsIntoCredentials.
Definition at line 955 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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 1039 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.IAllowCredentialsUsername.
Definition at line 1027 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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.IAllowCredentialsUsername.
Definition at line 1001 of file Credentials.cs.
| IAllowCredentialsServiceKeyWithCredentials 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 903 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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.IAllowCredentialsIntoCredentials.
Definition at line 864 of file Credentials.cs.
| IAllowCredentialsIntoCredentials GenerallyPositive.Credentials.WithScope | ( | OAuthScope | scope | ) |
Sets the OAuth scope to request when an access token is fetched.
| scope | Scope to request. |
Implements GenerallyPositive.IAllowCredentialsIntoCredentials.
Definition at line 844 of file Credentials.cs.
| IAllowCredentialsUsername 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 881 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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 1105 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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 1063 of file Credentials.cs.
| IAllowCredentialsIntoCredentials 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 1084 of file Credentials.cs.
| IAllowCredentialsIntoCredentials GenerallyPositive.Credentials.WithServiceKey | ( | string | key | ) |
Service key is a custom string consisting of your ClientID:ClientSecret.
| key | Combined "ClientId:ClientSecret" service key. |
Implements GenerallyPositive.IAllowCredentialsUsername.
Definition at line 986 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.IAllowCredentialsUsername.
Definition at line 892 of file Credentials.cs.
| IAllowCredentialsServiceKeyWithCredentials 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.IAllowCredentialsServiceKeyWithCredentials.
Definition at line 915 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.