Documentation ¶
Index ¶
- type APIKey
- type AssignServiceRoleToServiceAccountInput
- type AuthRequest
- type AuthResponse
- type AuthenticateServiceAccountError
- type CheckRevokedInput
- type CheckUserAuthorizationInput
- type CheckUserAuthorizationOutput
- type Client
- func (c *Client) AssignServicePermissionToServiceRole()
- func (c *Client) AssignServiceRoleToServiceAccount(ctx context.Context, input AssignServiceRoleToServiceAccountInput) (*ServiceAccount, error)
- func (c *Client) AuthenticateServiceAccount(ctx context.Context, serviceAccountID uuid.UUID, token string) (bool, error)
- func (c *Client) BlacklistToken()
- func (c *Client) CheckUserAuthorization(ctx context.Context, input CheckUserAuthorizationInput) (*CheckUserAuthorizationOutput, error)
- func (c *Client) ClearBlacklist()
- func (c *Client) CountBlacklistedTokens()
- func (c *Client) CreateAPIKey(apiKey APIKey) (APIKey, error)
- func (c *Client) CreateRefreshToken(ctx context.Context, input CreateRefreshTokenInput) (*RefreshToken, error)
- func (c *Client) CreateServicePermission()
- func (c *Client) CreateServiceRole(ctx context.Context, input CreateServiceRoleInput) (*ServiceRole, error)
- func (c *Client) CreateTemporaryData()
- func (c *Client) DecodeAccessToken()
- func (c *Client) DeleteAPIKey(id uuid.UUID) error
- func (c *Client) DeleteExpiredRefreshTokens(ctx context.Context, input DeleteExpiredRefreshTokensInput) error
- func (c *Client) DeleteExpiredTemporaryData()
- func (c *Client) DeleteServiceAccount(ctx context.Context, serviceAccountID uuid.UUID, apiKey string) error
- func (c *Client) DeleteServicePermission()
- func (c *Client) DeleteServiceRole(ctx context.Context, roleID uuid.UUID) error
- func (c *Client) DeleteTemporaryData()
- func (c *Client) DoesServicePermissionExist()
- func (c *Client) DoesServiceRoleExist()
- func (c *Client) FetchPrivateKey(ctx context.Context, input FetchPrivateKeyInput) ([]byte, error)
- func (c *Client) GenerateAccessToken()
- func (c *Client) GetAPIKeyByAPIKey(apiKey string) (*APIKey, error)
- func (c *Client) GetAPIKeyByID(id uuid.UUID) (*APIKey, error)
- func (c *Client) GetBlacklistedTokenDetails()
- func (c *Client) GetRefreshToken(ctx context.Context, input GetRefreshTokenInput) (*RefreshToken, error)
- func (c *Client) GetRefreshTokensForUser(ctx context.Context, input GetRefreshTokensForUserInput) ([]RefreshToken, error)
- func (c *Client) GetRolesForServiceAccount(ctx context.Context, input GetRolesForServiceAccountInput) ([]string, error)
- func (c *Client) GetServiceAccountByAPIKey(ctx context.Context, apiKey string) (*ServiceAccount, error)
- func (c *Client) GetServiceAccountByID(ctx context.Context, serviceAccountID uuid.UUID) (*ServiceAccount, error)
- func (c *Client) GetServiceAccountByName(ctx context.Context, serviceName string, apiKey string) (*ServiceAccount, error)
- func (c *Client) GetServiceAccountTokenMetadata(ctx context.Context, input GetServiceAccountTokenMetadataInput) (*ServiceAccountToken, error)
- func (c *Client) GetServiceAccountsByServiceRoleID(ctx context.Context, serviceRoleID uuid.UUID) ([]ServiceAccount, error)
- func (c *Client) GetServicePermissionByID()
- func (c *Client) GetServicePermissionByName()
- func (c *Client) GetServicePermissionsByServiceID()
- func (c *Client) GetServicePermissionsByServiceRoleIDInServicePermissionModel()
- func (c *Client) GetServicePermissionsByServiceRoleIDInServiceRoleServicePermissionsModel()
- func (c *Client) GetServiceRoleByID(ctx context.Context, id uuid.UUID) (*ServiceRole, error)
- func (c *Client) GetServiceRoleByName(ctx context.Context, name string) (*ServiceRole, error)
- func (c *Client) GetServiceRoleIDByName(ctx context.Context, name string) (*uuid.UUID, error)
- func (c *Client) GetServiceRolesByServiceAccountIDInServiceAccountModel(ctx context.Context, serviceAccountID uuid.UUID) ([]uuid.UUID, error)
- func (c *Client) GetServiceRolesByServiceAccountIDInServiceRoleModel()
- func (c *Client) GetServiceRolesByServicePermissionID()
- func (c *Client) GetTemporaryData()
- func (c *Client) GetTokenForUser(ctx context.Context, account UserAccount) (string, error)
- func (c *Client) InvalidateServiceAccountToken(ctx context.Context, input InvalidateServiceAccountTokenInput) error
- func (c *Client) IsRefreshTokenRevoked(input CheckRevokedInput) (bool, error)
- func (c *Client) IsServicePermissionAssignedToServiceRole()
- func (c *Client) IsServiceRoleAssignedToServiceAccount(ctx context.Context, input IsServiceRoleAssignedToServiceAccountInput) (bool, error)
- func (c *Client) IsTokenBlacklisted()
- func (c *Client) IssueServiceAccountToken(ctx context.Context, input IssueServiceAccountTokenInput) (*ServiceAccountToken, error)
- func (c *Client) ListAPIKeys() ([]APIKey, error)
- func (c *Client) ListBlacklistedTokens()
- func (c *Client) ListServiceAccountTokens(ctx context.Context, input ListServiceAccountTokensInput) ([]ServiceAccountToken, error)
- func (c *Client) ListServiceAccounts(ctx context.Context) ([]ServiceAccount, error)
- func (c *Client) ListServicePermissions()
- func (c *Client) ListServiceRoles(ctx context.Context) (*ListServiceRolesOutput, error)
- func (c *Client) ListTemporaryData()
- func (c *Client) Login(ctx context.Context, input LoginInput) (*LoginOutput, error)
- func (c *Client) RefreshServiceAccountToken(ctx context.Context, input RefreshServiceAccountTokenInput) (*TokenDetails, error)
- func (c *Client) RegisterServiceAccount(ctx context.Context, input RegisterServiceAccountInput) (*ServiceAccount, error)
- func (c *Client) RemoveServicePermissionFromServiceRole()
- func (c *Client) RemoveServiceRoleFromServiceAccount(ctx context.Context, serviceAccountID uuid.UUID, serviceRoleID uuid.UUID) error
- func (c *Client) RemoveTokenFromBlacklist()
- func (c *Client) RequestServiceAccountRegistration(ctx context.Context, input RequestServiceAccountRegistrationInput) (*ServiceAccount, error)
- func (c *Client) RetrieveServiceAccountToken(ctx context.Context, serviceAccountID uuid.UUID) (*TokenDetails, error)
- func (c *Client) RevokeAllRefreshTokensForUser(ctx context.Context, input RevokeAllRefreshTokensInput) error
- func (c *Client) RevokeRefreshToken(input RevokeRefreshTokenInput) error
- func (c *Client) SaveServiceAccountKey(ctx context.Context, input SaveServiceAccountKeyInput) (*ServiceAccountKey, error)
- func (c *Client) SignData(ctx context.Context, input SignDataInput) (*SignDataOutput, error)
- func (c *Client) UpdateAPIKey(key *APIKey) (*APIKey, error)
- func (c *Client) UpdateServiceAccount(ctx context.Context, input UpdateServiceAccountInput) (*ServiceAccount, error)
- func (c *Client) UpdateServicePermission()
- func (c *Client) UpdateServiceRole(ctx context.Context, input UpdateServiceRoleInput) (*ServiceRole, error)
- func (c *Client) UpdateTemporaryData()
- func (c *Client) ValidateAPIKey(apikey string) (bool, error)
- func (c *Client) ValidateAccessToken()
- func (c *Client) ValidateRefreshToken(ctx context.Context, input ValidateRefreshTokenInput) (bool, error)
- func (c *Client) VerifyServiceAccountToken(ctx context.Context, input VerifyServiceAccountTokenInput) (bool, error)
- func (c *Client) VerifyUserAuthentication(ctx context.Context, token string) (bool, error)
- type CreateRefreshTokenInput
- type CreateServiceRoleInput
- type DeleteExpiredRefreshTokensInput
- type ErrorResponse
- type FetchPrivateKeyInput
- type GetRefreshTokenInput
- type GetRefreshTokensForUserInput
- type GetRolesForServiceAccountInput
- type GetServiceAccountTokenMetadataInput
- type InvalidateServiceAccountTokenInput
- type IsRevokedResponse
- type IsServiceRoleAssignedToServiceAccountInput
- type IssueServiceAccountTokenInput
- type ListServiceAccountTokensInput
- type ListServiceRolesOutput
- type LoginInput
- type LoginOutput
- type RefreshServiceAccountTokenInput
- type RefreshToken
- type RegisterServiceAccountInput
- type RequestServiceAccountRegistrationInput
- type RevokeAllRefreshTokensInput
- type RevokeRefreshTokenInput
- type SaveServiceAccountKeyInput
- type ServiceAccount
- type ServiceAccountKey
- type ServiceAccountToken
- type ServiceRole
- type SignDataInput
- type SignDataOutput
- type TemporaryData
- type TokenBlacklist
- type TokenDetails
- type TokenService
- type UpdateServiceAccountInput
- type UpdateServiceRoleInput
- type UserAccount
- type ValidateRefreshTokenInput
- type ValidateRefreshTokenResponse
- type ValidateResponse
- type VerifyServiceAccountTokenInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct { ID uuid.UUID `json:"id"` ServiceAccountID uuid.UUID `json:"service_account_id"` APIKey string `json:"api_key"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Valid bool `json:"valid"` IsActive bool `json:"is_active"` ServiceName string `json:"service_name"` }
type AuthRequest ¶
type AuthResponse ¶
type AuthResponse struct {
Token string `json:"token"`
}
type AuthenticateServiceAccountError ¶
func (*AuthenticateServiceAccountError) Error ¶
func (e *AuthenticateServiceAccountError) Error() string
type CheckUserAuthorizationInput ¶
type CheckUserAuthorizationInput struct { UserID string `json:"user_id"` Resource string `json:"resource"` Action string `json:"action"` }
CheckUserAuthorizationInput represents the data required to check user authorization
type CheckUserAuthorizationOutput ¶
type CheckUserAuthorizationOutput struct {
Authorized bool `json:"authorized"`
}
CheckUserAuthorizationOutput represents the response from the authorization check
type Client ¶
Client represents an HTTP client that can be used to send requests to the authentication server.
func (*Client) AssignServicePermissionToServiceRole ¶
func (c *Client) AssignServicePermissionToServiceRole()
func (*Client) AssignServiceRoleToServiceAccount ¶
func (c *Client) AssignServiceRoleToServiceAccount(ctx context.Context, input AssignServiceRoleToServiceAccountInput) (*ServiceAccount, error)
func (*Client) AuthenticateServiceAccount ¶
func (*Client) BlacklistToken ¶
func (c *Client) BlacklistToken()
func (*Client) CheckUserAuthorization ¶
func (c *Client) CheckUserAuthorization(ctx context.Context, input CheckUserAuthorizationInput) (*CheckUserAuthorizationOutput, error)
CheckUserAuthorization checks if a user is authorized to perform a certain action on a resource
func (*Client) ClearBlacklist ¶
func (c *Client) ClearBlacklist()
func (*Client) CountBlacklistedTokens ¶
func (c *Client) CountBlacklistedTokens()
func (*Client) CreateRefreshToken ¶
func (c *Client) CreateRefreshToken(ctx context.Context, input CreateRefreshTokenInput) (*RefreshToken, error)
CreateRefreshToken creates a new refresh token
func (*Client) CreateServicePermission ¶
func (c *Client) CreateServicePermission()
func (*Client) CreateServiceRole ¶
func (c *Client) CreateServiceRole(ctx context.Context, input CreateServiceRoleInput) (*ServiceRole, error)
func (*Client) CreateTemporaryData ¶
func (c *Client) CreateTemporaryData()
func (*Client) DecodeAccessToken ¶
func (c *Client) DecodeAccessToken()
func (*Client) DeleteAPIKey ¶
DeleteAPIKey deletes the APIKey with the given id.
func (*Client) DeleteExpiredRefreshTokens ¶
func (c *Client) DeleteExpiredRefreshTokens(ctx context.Context, input DeleteExpiredRefreshTokensInput) error
func (*Client) DeleteExpiredTemporaryData ¶
func (c *Client) DeleteExpiredTemporaryData()
func (*Client) DeleteServiceAccount ¶
func (*Client) DeleteServicePermission ¶
func (c *Client) DeleteServicePermission()
func (*Client) DeleteServiceRole ¶
func (*Client) DeleteTemporaryData ¶
func (c *Client) DeleteTemporaryData()
func (*Client) DoesServicePermissionExist ¶
func (c *Client) DoesServicePermissionExist()
func (*Client) DoesServiceRoleExist ¶
func (c *Client) DoesServiceRoleExist()
func (*Client) FetchPrivateKey ¶
func (*Client) GenerateAccessToken ¶
func (c *Client) GenerateAccessToken()
func (*Client) GetAPIKeyByAPIKey ¶
func (*Client) GetBlacklistedTokenDetails ¶
func (c *Client) GetBlacklistedTokenDetails()
func (*Client) GetRefreshToken ¶
func (c *Client) GetRefreshToken(ctx context.Context, input GetRefreshTokenInput) (*RefreshToken, error)
GetRefreshToken fetches the refresh token from the auth server.
func (*Client) GetRefreshTokensForUser ¶
func (c *Client) GetRefreshTokensForUser(ctx context.Context, input GetRefreshTokensForUserInput) ([]RefreshToken, error)
GetRefreshTokensForUser sends a request to the authentication server to get all refresh tokens for a specific user.
func (*Client) GetRolesForServiceAccount ¶
func (*Client) GetServiceAccountByAPIKey ¶
func (*Client) GetServiceAccountByID ¶
func (*Client) GetServiceAccountByName ¶
func (*Client) GetServiceAccountTokenMetadata ¶
func (c *Client) GetServiceAccountTokenMetadata(ctx context.Context, input GetServiceAccountTokenMetadataInput) (*ServiceAccountToken, error)
func (*Client) GetServiceAccountsByServiceRoleID ¶
func (*Client) GetServicePermissionByID ¶
func (c *Client) GetServicePermissionByID()
func (*Client) GetServicePermissionByName ¶
func (c *Client) GetServicePermissionByName()
func (*Client) GetServicePermissionsByServiceID ¶
func (c *Client) GetServicePermissionsByServiceID()
func (*Client) GetServicePermissionsByServiceRoleIDInServicePermissionModel ¶
func (c *Client) GetServicePermissionsByServiceRoleIDInServicePermissionModel()
func (*Client) GetServicePermissionsByServiceRoleIDInServiceRoleServicePermissionsModel ¶
func (c *Client) GetServicePermissionsByServiceRoleIDInServiceRoleServicePermissionsModel()
func (*Client) GetServiceRoleByID ¶
func (*Client) GetServiceRoleByName ¶
func (*Client) GetServiceRoleIDByName ¶
func (*Client) GetServiceRolesByServiceAccountIDInServiceAccountModel ¶
func (c *Client) GetServiceRolesByServiceAccountIDInServiceAccountModel(ctx context.Context, serviceAccountID uuid.UUID) ([]uuid.UUID, error)
sky-auth/pkg/clientlib/authlib/service_accounts.go
func (*Client) GetServiceRolesByServiceAccountIDInServiceRoleModel ¶
func (c *Client) GetServiceRolesByServiceAccountIDInServiceRoleModel()
func (*Client) GetServiceRolesByServicePermissionID ¶
func (c *Client) GetServiceRolesByServicePermissionID()
func (*Client) GetTemporaryData ¶
func (c *Client) GetTemporaryData()
func (*Client) GetTokenForUser ¶
GetTokenForUser sends a request to the auth server to get a token for an account (user or service account).
func (*Client) InvalidateServiceAccountToken ¶
func (c *Client) InvalidateServiceAccountToken(ctx context.Context, input InvalidateServiceAccountTokenInput) error
func (*Client) IsRefreshTokenRevoked ¶
func (c *Client) IsRefreshTokenRevoked(input CheckRevokedInput) (bool, error)
func (*Client) IsServicePermissionAssignedToServiceRole ¶
func (c *Client) IsServicePermissionAssignedToServiceRole()
func (*Client) IsServiceRoleAssignedToServiceAccount ¶
func (*Client) IsTokenBlacklisted ¶
func (c *Client) IsTokenBlacklisted()
func (*Client) IssueServiceAccountToken ¶
func (c *Client) IssueServiceAccountToken(ctx context.Context, input IssueServiceAccountTokenInput) (*ServiceAccountToken, error)
func (*Client) ListAPIKeys ¶
ListAPIKeys retrieves all API keys.
func (*Client) ListBlacklistedTokens ¶
func (c *Client) ListBlacklistedTokens()
func (*Client) ListServiceAccountTokens ¶
func (c *Client) ListServiceAccountTokens(ctx context.Context, input ListServiceAccountTokensInput) ([]ServiceAccountToken, error)
func (*Client) ListServiceAccounts ¶
func (c *Client) ListServiceAccounts(ctx context.Context) ([]ServiceAccount, error)
func (*Client) ListServicePermissions ¶
func (c *Client) ListServicePermissions()
func (*Client) ListServiceRoles ¶
func (c *Client) ListServiceRoles(ctx context.Context) (*ListServiceRolesOutput, error)
func (*Client) ListTemporaryData ¶
func (c *Client) ListTemporaryData()
func (*Client) Login ¶
func (c *Client) Login(ctx context.Context, input LoginInput) (*LoginOutput, error)
Login sends a request to the login endpoint and returns an access token and refresh token on successful login
func (*Client) RefreshServiceAccountToken ¶
func (c *Client) RefreshServiceAccountToken(ctx context.Context, input RefreshServiceAccountTokenInput) (*TokenDetails, error)
func (*Client) RegisterServiceAccount ¶
func (c *Client) RegisterServiceAccount(ctx context.Context, input RegisterServiceAccountInput) (*ServiceAccount, error)
func (*Client) RemoveServicePermissionFromServiceRole ¶
func (c *Client) RemoveServicePermissionFromServiceRole()
func (*Client) RemoveServiceRoleFromServiceAccount ¶
func (*Client) RemoveTokenFromBlacklist ¶
func (c *Client) RemoveTokenFromBlacklist()
func (*Client) RequestServiceAccountRegistration ¶
func (c *Client) RequestServiceAccountRegistration(ctx context.Context, input RequestServiceAccountRegistrationInput) (*ServiceAccount, error)
func (*Client) RetrieveServiceAccountToken ¶
func (c *Client) RetrieveServiceAccountToken(ctx context.Context, serviceAccountID uuid.UUID) (*TokenDetails, error)
RetrieveServiceAccountToken retrieves or refreshes a service account token
func (*Client) RevokeAllRefreshTokensForUser ¶
func (c *Client) RevokeAllRefreshTokensForUser(ctx context.Context, input RevokeAllRefreshTokensInput) error
func (*Client) RevokeRefreshToken ¶
func (c *Client) RevokeRefreshToken(input RevokeRefreshTokenInput) error
RevokeRefreshToken revokes a refresh token by sending a POST request to the auth server.
func (*Client) SaveServiceAccountKey ¶
func (c *Client) SaveServiceAccountKey(ctx context.Context, input SaveServiceAccountKeyInput) (*ServiceAccountKey, error)
func (*Client) SignData ¶
func (c *Client) SignData(ctx context.Context, input SignDataInput) (*SignDataOutput, error)
func (*Client) UpdateServiceAccount ¶
func (c *Client) UpdateServiceAccount(ctx context.Context, input UpdateServiceAccountInput) (*ServiceAccount, error)
func (*Client) UpdateServicePermission ¶
func (c *Client) UpdateServicePermission()
func (*Client) UpdateServiceRole ¶
func (c *Client) UpdateServiceRole(ctx context.Context, input UpdateServiceRoleInput) (*ServiceRole, error)
func (*Client) UpdateTemporaryData ¶
func (c *Client) UpdateTemporaryData()
func (*Client) ValidateAPIKey ¶
ValidateAPIKey validates an API key.
func (*Client) ValidateAccessToken ¶
func (c *Client) ValidateAccessToken()
func (*Client) ValidateRefreshToken ¶
func (*Client) VerifyServiceAccountToken ¶
type CreateRefreshTokenInput ¶
type CreateRefreshTokenInput struct { UserID uuid.UUID `json:"user_id"` ExpiresAt time.Time `json:"expires_at"` }
CreateRefreshTokenInput represents the required input to create a refresh token
type CreateServiceRoleInput ¶
type DeleteExpiredRefreshTokensInput ¶
DeleteExpiredRefreshTokensInput represents the input for DeleteExpiredRefreshTokens
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
ErrorResponse represents the structure of an error response
type FetchPrivateKeyInput ¶
FetchPrivateKeyInput represents the required input to fetch a service account key
type GetRefreshTokenInput ¶
GetRefreshTokenInput defines the input for GetRefreshToken function.
type GetRefreshTokensForUserInput ¶
GetRefreshTokensForUserInput represents the input parameters for the GetRefreshTokensForUser function.
type GetServiceAccountTokenMetadataInput ¶
type GetServiceAccountTokenMetadataInput struct {
ServiceAccountTokenID uuid.UUID `json:"service_account_token_id"`
}
GetServiceAccountTokenMetadataInput represents the required input to get a service account token metadata
type InvalidateServiceAccountTokenInput ¶
type InvalidateServiceAccountTokenInput struct {
ServiceAccountTokenID uuid.UUID `json:"service_account_token_id"`
}
InvalidateServiceAccountTokenInput represents the required input to invalidate a service account token
type IsRevokedResponse ¶
type IsRevokedResponse struct {
IsRevoked bool `json:"is_revoked"`
}
type IssueServiceAccountTokenInput ¶
type IssueServiceAccountTokenInput struct {
ServiceAccountID uuid.UUID `json:"service_account_id"`
}
IssueServiceAccountTokenInput represents the required input to issue a service account token
type ListServiceAccountTokensInput ¶
type ListServiceAccountTokensInput struct {
ServiceAccountID uuid.UUID `json:"service_account_id,omitempty"` // optional
}
ListServiceAccountTokensInput represents the required input to list service account tokens
type ListServiceRolesOutput ¶
type ListServiceRolesOutput struct {
ServiceRoles []ServiceRole `json:"service_roles"`
}
ListServiceRolesOutput is the response structure for listing service roles
type LoginInput ¶
LoginInput represents the data required for login
type LoginOutput ¶
type LoginOutput struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` }
LoginOutput represents the data returned after successful login
type RefreshServiceAccountTokenInput ¶
type RefreshServiceAccountTokenInput struct { ServiceAccountTokenID uuid.UUID `json:"service_account_token_id"` RefreshToken string `json:"refresh_token"` }
RefreshServiceAccountTokenInput represents the required input to refresh a service account token
type RefreshToken ¶
type RefreshToken struct { ID uuid.UUID `json:"id"` UserID uuid.UUID `json:"user_id"` TokenHash []byte `json:"token_hash"` IssuedAt time.Time `json:"issued_at"` ExpiresAt time.Time `json:"expires_at"` IsRevoked bool `json:"is_revoked"` }
RefreshToken represents the structure of a refresh token
type RequestServiceAccountRegistrationInput ¶
type RequestServiceAccountRegistrationInput struct { ServiceName string `json:"service_name"` ApiKey string `json:"api_key,omitempty"` // Optional, if you want to include an ApiKey BootstrapToken string `json:"bootstrap_token,omitempty"` // Optional, if you want to include a BootstrapToken Roles []string `json:"roles"` }
type RevokeRefreshTokenInput ¶
RevokeRefreshTokenInput represents the input parameters for RevokeRefreshToken function
type SaveServiceAccountKeyInput ¶
SaveServiceAccountKeyInput represents the required input to save a service account key
type ServiceAccount ¶
type ServiceAccount struct { ID uuid.UUID `db:"id" json:"id"` Secret string `db:"secret" json:"-"` HashedSecret string `json:"hashed_secret"` ServiceName string `db:"service_name" json:"service_name"` ServiceRoles []string `json:"service_roles"` CreatedAt time.Time `db:"created_at" json:"created_at"` ExpiresAt *time.Time `db:"expires_at" json:"expires_at,omitempty"` IsActive bool `json:"is_active"` APIKey string `json:"-"` // Omit API Key in JSON responses by default. AccessToken string `json:"-"` // Omit AccessToken in JSON responses by default. RefreshToken string `json:"-"` // Omit RefreshToken in JSON responses by default. }
type ServiceAccountKey ¶
type ServiceAccountKey struct { ID uuid.UUID `json:"id"` ServiceAccountID uuid.UUID `json:"service_account_id"` PublicKey []byte `json:"public_key"` PrivateKey []byte `json:"private_key"` CreatedAt time.Time `json:"created_at"` }
ServiceAccountKey represents the structure of a service account key
type ServiceAccountToken ¶
type ServiceAccountToken struct { ID uuid.UUID `json:"id"` ServiceAccountID uuid.UUID `json:"service_account_id"` Token string `json:"token"` RefreshToken string `json:"refresh_token"` IssuedAt time.Time `json:"issued_at"` TokenExpiresAt time.Time `json:"token_expires_at"` RefreshTokenExpiresAt time.Time `json:"refresh_token_expires_at"` }
ServiceAccountToken represents the structure of a service account token
type ServiceRole ¶
type SignDataInput ¶
type SignDataInput struct { ServiceAccountID uuid.UUID `json:"service_account_id"` Data []byte `json:"data"` }
SignDataInput represents the required input to sign data
type SignDataOutput ¶
type SignDataOutput struct {
Signature []byte `json:"signature"`
}
SignDataOutput represents the response from the sign data API
type TemporaryData ¶
type TemporaryData struct { ID uuid.UUID `json:"id"` Data []byte `json:"data"` CreatedAt time.Time `json:"created_at"` ExpiresAt time.Time `json:"expires_at"` }
TemporaryData represents the structure of a temporary data entry
type TokenBlacklist ¶
TokenBlacklist represents the structure of a blacklisted token
type TokenDetails ¶
type TokenDetails struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` AtExpires int64 `json:"at_expires"` RtExpires int64 `json:"rt_expires"` }
TokenDetails represents the structure of issued tokens and their expiry details
type TokenService ¶
type TokenService struct { PrivateKey ed25519.PrivateKey TokenTTL time.Duration }
type UpdateServiceAccountInput ¶
type UpdateServiceAccountInput struct { ServiceAccount *ServiceAccount `json:"service_account"` ApiKey string `json:"api_key,omitempty"` // Optional, if you want to include an ApiKey }
type UpdateServiceRoleInput ¶
type UserAccount ¶
Account represents an entity (user or service account) that can authenticate.
type ValidateResponse ¶
type ValidateResponse struct {
IsValid bool `json:"is_valid"`
}