Interface IAuthApi
Entry point for communication with a ZEDAL server instance.
public interface IAuthApi
Properties
- AccessToken
Gets identifies an access_token for the given refresh_token.
- AccessTokenChanged
Gets or sets callback for the event of Updating the AccessToken. For a session with an ApiKey the refreshToken is
null.
- ActiveProvider
Gets the Active Endpoint.
- NotGrantedScopes
Gets the scopes of the app token that an ApiKey could grant but the key of the current session does not. Empty for sessions without an API key, and after ContinueSession(ApiKey, AppToken, AccessToken, ZedalCallContext) took over a kept access token without an exchange; the next exchange fills it again. Whether the application needs them depends on the calls it makes.
- RefreshToken
Gets identifies a refresh_token that depicts a session.
nullfor a session with an ApiKey, which has no refresh_token.
Methods
- ContinueSession(ApiKey, AppToken, AccessToken, ZedalCallContext)
Continues a session with an API key from an access token the client kept, e.g. across process runs. The access token is used as long as it was issued for this key and this app and has not expired; otherwise the key is exchanged as in CreateSession(ApiKey, AppToken, ZedalCallContext). Keeping the access token saves exchanges, which the server limits per key.
- ContinueSession(RefreshToken, ZedalCallContext)
Logging into an instance with the refreshToken.
- CreateApiKey(string, string, IEnumerable<string>, DateTimeOffset?, ZedalCallContext)
Creates an API key for the calling account. The key is returned only here and can never be retrieved again — store it as a secret. Requires scope
usermgt.
- CreateSession(int, string, string, string, AppToken, ZedalCallContext)
Logging into an instance with the credentials provided.
- CreateSession(string, AppToken, ZedalCallContext)
Logging into an instance with the userId.
- CreateSession(ApiKey, AppToken, ZedalCallContext)
Logging into an instance with an API key. The key is exchanged together with the app token directly for an access token; there is no refresh token. Once the access token is about to expire, the key is exchanged again.
- CreateSession(ClientId, string, AppToken, ZedalCallContext)
Logging into an instance with the clientId.
- EndSession(ZedalCallContext)
Logging out of an instance this ends the current session and invalidates the refresh token. In order to continue using the instance, it must be reauthorized. A session with an ApiKey only forgets the key; the key stays valid until RevokeApiKey(string, ZedalCallContext).
- EnsureLoggedIn(ZedalCallContext)
Test to determine if we are not logged in or if the jwt token has expired, then try to renew the connection server-side logout should be handled by the client to avoid looping. A session needs a refresh token or an ApiKey.
- GetCallOptions(ZedalCallContext)
Builds the CallOption object for Grpc API calls.
- GetUserInfo(ZedalCallContext)
Reads the current profile data of the signed-in account, modelled on the OpenID Connect UserInfo endpoint. Use it instead of the claims of the tokens: the values are read when the call is made. Requires scope
openid, otherwise the call fails withPERMISSION_DENIED; the scopesprofileandemailselect the fields of the result.
- IssueClientId(int, string, string, string, string, ZedalCallContext)
Issues a clientId and secret for the user account that can be used for automated processing.
- ListApiKeys(ZedalCallContext)
Lists the active API keys of the calling account, for the main account including those of its subaccounts (see
AccountIdof each entry), without the keys themselves. Requires scopeusermgt.
- ListClientIds(ZedalCallContext)
Lists all existing client ids for the user account.
- ListSessions(ZedalCallContext)
Lists all existing sessions for the user account.
- RefreshAccessToken(ZedalCallContext)
Refreshes the old AccessToken with a new one This bypasses the Token-interceptor !!!.
- RevokeApiKey(string, ZedalCallContext)
Revokes an API key of the calling account; the main account may also revoke the keys of its subaccounts. No new access token can be obtained with the key afterwards. Requires scope
usermgt.
- RevokeClientId(ClientId, ZedalCallContext)
Revokes a clientId for the user account. All refresh tokens that were issued using this client id will be revoked as well.
- RevokeClientIdByTokenId(string, ZedalCallContext)
Revokes a clientId for the user account. All refresh tokens that were issued using this client id will be revoked as well.
- RevokeRefreshTokenByFamilyId(string, ZedalCallContext)
Invalidates the token family with this id. Effectively logs out that session. Authenticates with the AccessToken of the running session and requires scope
usermgt. The family must belong to the caller's subscriber: a subaccount may only revoke its own families, the main account those of all accounts of the subscriber; otherwise the call fails withPERMISSION_DENIED.
- RevokeRefreshTokenByToken(string, ZedalCallContext)
Invalidates the token family of this RefreshToken. Effectively logs out that session. Authenticates with the AccessToken of the running session; no scope required.