Package codes.grow.packages.infisical
Class UniversalAuth
java.lang.Object
codes.grow.packages.infisical.UniversalAuth
- All Implemented Interfaces:
Authenticator
Logs a machine identity in with a client id and secret (
POST
/api/v1/auth/universal-auth/login). The client's token manager renews tokens at 80 % of their
lifetime and logs in again when renewal is no longer possible.
Infisical locks a Universal Auth identity after repeated failed logins (default 3 failures, 300 s, during which even the right secret fails); the client never retries a rejected login.
-
Constructor Summary
ConstructorsConstructorDescriptionUniversalAuth(String clientId, Secret clientSecret, String organizationSlug) Creates the method.UniversalAuth(String clientId, String clientSecret) Creates the method. -
Method Summary
Modifier and TypeMethodDescriptionclientId()Returns the client id.login(InfisicalClient client) Obtains a new access token throughclient(login calls are sent without anAuthorizationheader).loginAsync(InfisicalClient client) Asynchronouslogin(InfisicalClient).Returns the sub-organization slug.renew(InfisicalClient client, Secret token) Extends a token on the server (POST /api/v1/auth/token/renew).renewAsync(InfisicalClient client, Secret token) Asynchronousrenew(InfisicalClient, Secret).voidrevoke(InfisicalClient client, Secret token) Revokes a token (POST /api/v1/auth/token/revoke); revoking twice succeeds.revokeAsync(InfisicalClient client, Secret token) Asynchronousrevoke(InfisicalClient, Secret).toString()
-
Constructor Details
-
UniversalAuth
Creates the method.- Parameters:
clientId- Universal Auth client idclientSecret- Universal Auth client secret
-
UniversalAuth
Creates the method.- Parameters:
clientId- Universal Auth client idclientSecret- Universal Auth client secretorganizationSlug- sub-organization slug, may be null
-
-
Method Details
-
clientId
Returns the client id.- Returns:
- the client id
-
organizationSlug
Returns the sub-organization slug.- Returns:
- the slug, or empty
-
login
Description copied from interface:AuthenticatorObtains a new access token throughclient(login calls are sent without anAuthorizationheader).- Specified by:
loginin interfaceAuthenticator- Parameters:
client- the client the token is for- Returns:
- the token
-
loginAsync
Asynchronouslogin(InfisicalClient).- Parameters:
client- the client- Returns:
- a future with the token
-
renew
Extends a token on the server (POST /api/v1/auth/token/renew). Always keep the returned token (it may be byte-identical); it cannot outlive its maximum TTL.- Parameters:
client- the clienttoken- the token to renew- Returns:
- the renewed token
-
renewAsync
Asynchronousrenew(InfisicalClient, Secret).- Parameters:
client- the clienttoken- the token to renew- Returns:
- a future with the renewed token
-
revoke
Revokes a token (POST /api/v1/auth/token/revoke); revoking twice succeeds.- Parameters:
client- the clienttoken- the token to revoke
-
revokeAsync
Asynchronousrevoke(InfisicalClient, Secret).- Parameters:
client- the clienttoken- the token to revoke- Returns:
- a future completed when revoked
-
toString
-