跳到主要内容

Go API reference

github.com/axis-iam/vertex-sdk-go​

package iam // import "github.com/axis-iam/vertex-sdk-go"

Package iam is the entry point for github.com/axis-iam/vertex-sdk-go, a Go SDK
that integrates with the IAM Authentication Center.

It exposes:

- SDKConfig — runtime configuration for the SDK
- SDK — orchestrator that wires JWT verification, permission resolution and
optional startup-time permission registration
- Shortcut constructors for net/http middleware via the
github.com/axis-iam/vertex-sdk-go/middleware sub-package

Framework-specific adapters live in their own submodules to avoid pulling
unrelated router dependencies into callers:

- github.com/axis-iam/vertex-sdk-go/chi
- github.com/axis-iam/vertex-sdk-go/gin
- github.com/axis-iam/vertex-sdk-go/echo

CONSTANTS

const PermissionsSyncScope = "permissions:sync"
PermissionsSyncScope authorizes structured permission manifest
synchronization.


VARIABLES

var (
// ErrPortalOpenAPIConfig identifies invalid Portal Open API client configuration.
ErrPortalOpenAPIConfig = errors.New("iam portal open api: config error")
// ErrPortalOpenAPIToken identifies token acquisition or token response failures.
ErrPortalOpenAPIToken = errors.New("iam portal open api: token error")
// ErrPortalOpenAPIRequest identifies Portal resource request failures.
ErrPortalOpenAPIRequest = errors.New("iam portal open api: request error")
)

FUNCTIONS

func FromContext(ctx context.Context) *authz.User
FromContext returns the authenticated IAM user carried by ctx, if any.

func MustUser(ctx context.Context) (*authz.User, error)
MustUser returns the authenticated IAM user or authz.ErrUnauthenticated.

func PermissionDeclarationRevision(declaration PermissionManifestDeclaration) (string, error)
PermissionDeclarationRevision computes a validated declaration's canonical
digest.


TYPES

type APIError struct {
Status int
Body string
}
APIError is returned for non-2xx responses from the IAM server.

func (e *APIError) Error() string

func (e *APIError) IsRetryable() bool
IsRetryable reports whether the error should trigger retries.

type AccountIdentifier struct {
Capabilities map[IdentifierAction]IdentifierCapability `json:"capabilities,omitempty" wire:"optional"`
ID string `json:"id"`
Kind IdentifierKind `json:"kind"`
DisplayValue string `json:"displayValue"`
Status string `json:"status"`
VerificationState string `json:"verificationState"`
VerifiedAt *string `json:"verifiedAt,omitempty" wire:"optional"`
VerificationSource *string `json:"verificationSource,omitempty" wire:"optional"`
IsPrimary bool `json:"isPrimary"`
ManagedBy *string `json:"managedBy,omitempty" wire:"optional"`
}
AccountIdentifier mirrors the current-user producer contract.

type AccountIdentifiers struct {
Management *IdentifierManagement `json:"management,omitempty"`
LoginMethodVersion int64 `json:"loginMethodVersion"`
Items []AccountIdentifier `json:"items"`
}
AccountIdentifiers mirrors the current-user producer contract.

type AccountLoginMethod struct {
MethodID string `json:"methodId"`
Kind string `json:"kind"`
Roles []string `json:"roles"`
Status string `json:"status"`
IdentifierID *string `json:"identifierId,omitempty" wire:"optional"`
CredentialID *string `json:"credentialId,omitempty" wire:"optional"`
IdentityID *string `json:"identityId,omitempty" wire:"optional"`
ProviderID *string `json:"providerId,omitempty" wire:"optional"`
Capabilities map[string]bool `json:"capabilities"`
UnavailableReasons []string `json:"unavailableReasons"`
}
AccountLoginMethod mirrors the current-user producer contract.

type AccountLoginMethods struct {
LoginMethodVersion int64 `json:"loginMethodVersion"`
Methods []AccountLoginMethod `json:"methods"`
}
AccountLoginMethods mirrors the current-user producer contract.

type AccountOrganization struct {
OrganizationID string `json:"organizationId"`
Name string `json:"name"`
Slug string `json:"slug,omitempty"`
Role string `json:"role"`
JoinedAt string `json:"joinedAt,omitempty"`
Current bool `json:"current"`
}
AccountOrganization is the current user's Application-scoped Organization
membership.

type AccountPermissionSummary struct {
ApplicationID string `json:"applicationId"`
OrganizationID string `json:"organizationId,omitempty"`
Roles []string `json:"roles"`
Permissions []string `json:"permissions"`
}
AccountPermissionSummary is the current user's IAM-resolved permission
summary.

type AccountSecurityError struct {
Status int
Code string
RetryAfterSeconds *int
}
AccountSecurityError retains only stable producer metadata, never a raw
error body.

func (e *AccountSecurityError) Error() string

type AccountSecurityProtocolError struct{}
AccountSecurityProtocolError indicates a missing or malformed known wire
field.

func (*AccountSecurityProtocolError) Error() string

type AccountSecuritySummary struct {
EmailVerified bool `json:"emailVerified"`
PasswordCredentialPresent bool `json:"passwordCredentialPresent"`
MFAEnrolled bool `json:"mfaEnrolled"`
TOTPEnrolled bool `json:"totpEnrolled"`
WebAuthnEnrolled bool `json:"webAuthnEnrolled"`
ActiveSessionCount int `json:"activeSessionCount"`
}
AccountSecuritySummary is the current user's secret-free security summary.

type AccountSecurityTransportError struct {
OutcomeUnknown bool
// Has unexported fields.
}
AccountSecurityTransportError means a mutation may have committed. It is
never retried by this SDK.

func (*AccountSecurityTransportError) Error() string

func (e *AccountSecurityTransportError) Unwrap() error

type AccountUpdateProfileRequest struct {
DisplayName string `json:"displayName,omitempty"`
AvatarURL string `json:"avatarUrl,omitempty"`
}
AccountUpdateProfileRequest is the safe scalar profile update request.

type AddIdentity struct {
Identifier LoginIdentifier `json:"identifier"`
}
AddIdentity mirrors the current-user producer contract.

type AuthOption func(*middleware.AuthConfig)
AuthOption configures the Authenticate middleware.

func WithAuthResponder(r middleware.ErrorResponder) AuthOption
WithAuthResponder substitutes the ErrorResponder used when authentication
fails.

type AuthenticationContext struct {
SubjectType string `json:"subjectType"`
ApplicationID string `json:"applicationId"`
ClientID string `json:"clientId"`
SessionID string `json:"sessionId"`
WorkspaceID *string `json:"workspaceId"`
WorkspaceSelectionRequired bool `json:"workspaceSelectionRequired"`
OrganizationID *string `json:"organizationId"`
OrganizationSlug *string `json:"organizationSlug"`
OrganizationRole *string `json:"organizationRole"`
AuthTime *time.Time `json:"authTime"`
AuthenticationMethods []string `json:"authenticationMethods"`
AssuranceLevel *string `json:"assuranceLevel"`
Impersonation *ImpersonationContext `json:"impersonation"`
}
AuthenticationContext carries the authenticated subject and Application
bindings.

type AuthorizationCreateOptions struct{ IdempotencyKey string }
AuthorizationCreateOptions carries an optional retry-safe Idempotency-Key.

type AuthorizationPageMetadata struct {
Size int `json:"size"`
Number int `json:"number"`
TotalElements int64 `json:"totalElements"`
TotalPages int `json:"totalPages"`
}
AuthorizationPageMetadata is the nested Spring PagedModel metadata.

type AuthorizationPageOptions struct {
Page *int
Size *int
}
AuthorizationPageOptions selects a zero-based page with a maximum size of
100.

type AuthorizationPurpose string
AuthorizationPurpose is an operation wire enum; unsupported response values
fail closed.

const (
AuthorizationPurposeCurrentAccount AuthorizationPurpose = "CURRENT_ACCOUNT"
AuthorizationPurposeTargetOwnership AuthorizationPurpose = "TARGET_OWNERSHIP"
AuthorizationPurposeTransferCounterpart AuthorizationPurpose = "TRANSFER_COUNTERPART"
)
Supported AuthorizationPurpose wire values.

type Client struct {
// Has unexported fields.
}
Client is a low-level HTTP client against the IAM server's /open/v1 API.
It is safe for concurrent use.

func NewClient(cfg *SDKConfig) (*Client, error)
NewClient constructs a Client from cfg. cfg.Validate() is called;
callers should normally use New (in sdk.go) which also builds the verifier,
resolver and registrar.

func (c *Client) AcceptOrganizationInvitation(ctx context.Context, invitationToken, accessToken string) (*PublicOrganizationInvitationAcceptResponse, error)
AcceptOrganizationInvitation calls the public invitation accept endpoint.
Pass an empty accessToken to receive IAM's login-required continuation when
unauthenticated.

func (c *Client) AuthorizeIdentityOperation(ctx context.Context, accessToken string, operationID string, request IdentityProviderAuthorize) (*ProviderAuthorization, error)
AuthorizeIdentityOperation calls POST
/api/v1/auth/me/identity-operations/{id}/authorize without mutation replay.

func (c *Client) AuthorizeMFAOperation(ctx context.Context, accessToken string, operationID string, request MFAProviderAuthorize) (*ProviderAuthorization, error)
AuthorizeMFAOperation calls POST /api/v1/auth/mfa/operations/{id}/authorize
without mutation replay.

func (c *Client) BeginTOTPEnrollmentOperation(ctx context.Context, accessToken string, operationID string) (*TOTPBeginResult, error)
BeginTOTPEnrollmentOperation calls POST
/api/v1/auth/mfa/operations/{id}/begin without mutation replay.

func (c *Client) CancelIdentityOperation(ctx context.Context, accessToken string, operationID string) (*IdentityOperation, error)
CancelIdentityOperation calls POST
/api/v1/auth/me/identity-operations/{id}/cancel without mutation replay.

func (c *Client) CancelMFAOperation(ctx context.Context, accessToken string, operationID string) (*MFAOperation, error)
CancelMFAOperation calls POST /api/v1/auth/mfa/operations/{id}/cancel
without mutation replay.

func (c *Client) ChallengeIdentityCurrentAccount(ctx context.Context, accessToken string, operationID string, identifierID string) (*IdentityChallengeResult, error)
ChallengeIdentityCurrentAccount calls POST
/api/v1/auth/me/identity-operations/{id}/current-account/challenges without
mutation replay.

func (c *Client) ChallengeIdentityOperation(ctx context.Context, accessToken string, operationID string, targetProofMethod TargetProofMethod) (*IdentityOperation, error)
ChallengeIdentityOperation calls POST
/api/v1/auth/me/identity-operations/{id}/challenges without mutation replay.

func (c *Client) ChallengeMFAOperation(ctx context.Context, accessToken string, operationID string, identifierID string) (*MFAChallengeResult, error)
ChallengeMFAOperation calls POST /api/v1/auth/mfa/operations/{id}/challenges
without mutation replay.

func (c *Client) ChangePassword(ctx context.Context, accessToken string, input PasswordChangeRequest) error
ChangePassword calls the authenticated password-change endpoint.

func (c *Client) CheckAccountPermission(ctx context.Context, accessToken, permission, organizationID string) (*PermissionCheckResponse, error)
CheckAccountPermission checks one permission through IAM. Wildcard semantics
are backend-owned.

func (c *Client) CompleteIdentityOperation(ctx context.Context, accessToken string, operationID string, request IdentityOperationComplete) (*IdentityOperation, error)
CompleteIdentityOperation calls POST
/api/v1/auth/me/identity-operations/{id}/complete without mutation replay.

func (c *Client) CompleteIdentityProviderAuthorization(ctx context.Context, accessToken string, operationID string, request ProviderExchange) (*IdentityOperation, error)
CompleteIdentityProviderAuthorization calls POST
/api/v1/auth/me/identity-operations/{id}/provider-callback without mutation
replay.

func (c *Client) CompleteMFAOperation(ctx context.Context, accessToken string, operationID string, code *string) (*MFACompletionResult, error)
CompleteMFAOperation calls POST /api/v1/auth/mfa/operations/{id}/complete
without mutation replay.

func (c *Client) CompleteMFAProviderAuthorization(ctx context.Context, accessToken string, operationID string, request ProviderExchange) (*MFAOperation, error)
CompleteMFAProviderAuthorization calls POST
/api/v1/auth/mfa/operations/{id}/provider-callback without mutation replay.

func (c *Client) Config() *SDKConfig
Config returns a pointer to the underlying config. Callers must not mutate
fields used by the SDK (Endpoint, ClientID, ...).

func (c *Client) ConfirmIdentityTransfer(ctx context.Context, accessToken string, operationID string, decision TransferDecision) (*IdentityOperation, error)
ConfirmIdentityTransfer calls POST
/api/v1/auth/me/identity-operations/{id}/confirm-transfer without mutation
replay.

func (c *Client) CreateIdentityOperation(ctx context.Context, accessToken string, request IdentityOperationCreate, idempotencyKey string) (*IdentityOperation, error)
CreateIdentityOperation calls POST /api/v1/auth/me/identity-operations
without mutation replay.

func (c *Client) CreateMFAOperation(ctx context.Context, accessToken string, request MFAOperationCreate, idempotencyKey string) (*MFAOperation, error)
CreateMFAOperation calls POST /api/v1/auth/mfa/operations without mutation
replay.

func (c *Client) Endpoint() string
Endpoint returns the normalized IAM endpoint (no trailing slash).

func (c *Client) GetAccountPermissionSummary(ctx context.Context, accessToken, organizationID string) (*AccountPermissionSummary, error)
GetAccountPermissionSummary resolves current-user permissions in the active
or explicit Organization context.

func (c *Client) GetAccountProfile(ctx context.Context, accessToken string) (*UserProfile, error)
GetAccountProfile calls GET /api/v1/auth/me/profile with the user's bearer
token.

func (c *Client) GetAccountSecuritySummary(ctx context.Context, accessToken string) (*AccountSecuritySummary, error)
GetAccountSecuritySummary calls GET /api/v1/auth/me/security with the user's
bearer token.

func (c *Client) GetCurrentAccountOrganization(ctx context.Context, accessToken string) (*AccountOrganization, error)
GetCurrentAccountOrganization calls GET
/api/v1/auth/me/organizations/current.

func (c *Client) GetCurrentUser(ctx context.Context, accessToken string) (*CurrentUser, error)
GetCurrentUser reads context explicitly with a user bearer. It does not
resolve or verify token bytes locally.

func (c *Client) GetIdentityOperation(ctx context.Context, accessToken string, operationID string) (*IdentityOperation, error)
GetIdentityOperation calls GET /api/v1/auth/me/identity-operations/{id}
without mutation replay.

func (c *Client) GetMFACapabilities(ctx context.Context, accessToken string) (*MFACapabilities, error)
GetMFACapabilities calls GET /api/v1/auth/mfa/capabilities without mutation
replay.

func (c *Client) GetMFAOperation(ctx context.Context, accessToken string, operationID string) (*MFAOperation, error)
GetMFAOperation calls GET /api/v1/auth/mfa/operations/{id} without mutation
replay.

func (c *Client) GetMe(ctx context.Context, accessToken string) (*UserProfile, error)
GetMe calls GET /api/v1/auth/me/profile with the user's bearer access token.
It is uncached; use SDK.GetMe for the short-TTL profile cache. The returned
Metadata is profile metadata, not authorization attributes.

func (c *Client) GetRecoveryCodesRemaining(ctx context.Context, accessToken string) (*RecoveryCodesRemaining, error)
GetRecoveryCodesRemaining reads the current user's live unused recovery-code
count.

func (c *Client) HTTP() *http.Client
HTTP exposes the underlying http.Client (e.g. for test override).

func (c *Client) HasAccountOrganizationMembership(ctx context.Context, accessToken, organizationID string) (bool, error)
HasAccountOrganizationMembership derives membership from the Organization
list.

func (c *Client) JWKS(ctx context.Context, jwksURL string) ([]byte, error)
JWKS returns the raw JWKS JSON body served by the issuer's well-known
endpoint. Used by the jwt sub-package.

func (c *Client) ListAccountIdentifiers(ctx context.Context, accessToken string) (*AccountIdentifiers, error)
ListAccountIdentifiers calls GET /api/v1/auth/me/identifiers without
mutation replay.

func (c *Client) ListAccountLoginMethods(ctx context.Context, accessToken string) (*AccountLoginMethods, error)
ListAccountLoginMethods calls GET /api/v1/auth/me/login-methods without
mutation replay.

func (c *Client) ListAccountOrganizations(ctx context.Context, accessToken string) ([]AccountOrganization, error)
ListAccountOrganizations calls GET /api/v1/auth/me/organizations.

func (c *Client) ListAccountSessions(ctx context.Context, accessToken string) ([]SessionView, error)
ListAccountSessions lists the current user's active sessions.

func (c *Client) ListIdentityTransfers(ctx context.Context, accessToken string) ([]IdentityOperation, error)
ListIdentityTransfers calls GET
/api/v1/auth/me/identity-operations/transfers without mutation replay.

func (c *Client) ListLinkableIdentityProviders(ctx context.Context, accessToken string) ([]LinkableIdentityProvider, error)
ListLinkableIdentityProviders calls GET
/api/v1/auth/me/linkable-identity-providers without mutation replay.

func (c *Client) ListPermissions(ctx context.Context, clientID string) (*ListPermissionsResponse, error)
ListPermissions calls GET /open/v1/apps/{cid}/permissions.

func (c *Client) LogoutAccount(ctx context.Context, accessToken string) error
LogoutAccount blacklists the current token/session and revokes its OAuth
session.

func (c *Client) PreviewOrganizationInvitation(ctx context.Context, invitationToken string) (*PublicOrganizationInvitationPreview, error)
PreviewOrganizationInvitation calls the public invitation preview endpoint
without bearer auth.

func (c *Client) ReauthenticateIdentityOperation(ctx context.Context, accessToken string, operationID string, request Reauthentication) (*IdentityOperation, error)
ReauthenticateIdentityOperation calls POST
/api/v1/auth/me/identity-operations/{id}/reauthenticate without mutation
replay.

func (c *Client) ReauthenticateMFAOperation(ctx context.Context, accessToken string, operationID string, request Reauthentication) (*MFAOperation, error)
ReauthenticateMFAOperation calls POST
/api/v1/auth/mfa/operations/{id}/reauthenticate without mutation replay.

func (c *Client) RequestPasswordReset(ctx context.Context, email, redirectURI string) error
RequestPasswordReset starts the opaque public forgot-password flow.

func (c *Client) ResetPassword(ctx context.Context, token, newPassword string) error
ResetPassword completes the public password reset flow.

func (c *Client) ResolvePermissions(ctx context.Context, clientID string, roles []string) (*ResolvePermissionsResponse, error)
ResolvePermissions calls POST /open/v1/permissions:resolve.

func (c *Client) RevokeAccountSession(ctx context.Context, accessToken, sessionID string) error
RevokeAccountSession revokes one session owned by the current user.

func (c *Client) RevokeOtherAccountSessions(ctx context.Context, accessToken string) error
RevokeOtherAccountSessions revokes all sessions except the current token's
sid.

func (c *Client) SendEmailVerification(ctx context.Context, email string) (*EmailVerificationResponse, error)
SendEmailVerification starts the opaque public email verification send flow.

func (c *Client) SetHTTPClient(h *http.Client)
SetHTTPClient lets callers inject a custom http.Client. Intended for tests.

func (c *Client) StartIdentityOperationStepUp(ctx context.Context, accessToken string, operationID string) (*OperationStepUpChallenge, error)
StartIdentityOperationStepUp calls POST
/api/v1/auth/me/identity-operations/{id}/step-up/start without mutation
replay.

func (c *Client) StartIdentityOperationWebAuthn(ctx context.Context, accessToken string, operationID string, challengeID string) (*OperationWebAuthnStart, error)
StartIdentityOperationWebAuthn calls POST
/api/v1/auth/me/identity-operations/{id}/step-up/webauthn/start without
mutation replay.

func (c *Client) StartMFAOperationStepUp(ctx context.Context, accessToken string, operationID string) (*OperationStepUpChallenge, error)
StartMFAOperationStepUp calls POST
/api/v1/auth/mfa/operations/{id}/step-up/start without mutation replay.

func (c *Client) StartMFAOperationWebAuthn(ctx context.Context, accessToken string, operationID string, challengeID string) (*OperationWebAuthnStart, error)
StartMFAOperationWebAuthn calls POST
/api/v1/auth/mfa/operations/{id}/step-up/webauthn/start without mutation
replay.

func (c *Client) SwitchAccountOrganization(ctx context.Context, accessToken, organizationID string) (*OrganizationSwitchResponse, error)
SwitchAccountOrganization validates membership and returns the server
continuation.

func (c *Client) UpdateAccountProfile(ctx context.Context, accessToken string, input AccountUpdateProfileRequest) (*UserProfile, error)
UpdateAccountProfile calls PATCH /api/v1/auth/me/profile with safe scalar
profile fields.

func (c *Client) VerifyEmail(ctx context.Context, token string) (*EmailVerificationResponse, error)
VerifyEmail verifies a public email-verification token.

func (c *Client) VerifyIdentityOperationStepUp(ctx context.Context, accessToken string, operationID string, request OperationStepUpVerify) (*IdentityOperation, error)
VerifyIdentityOperationStepUp calls POST
/api/v1/auth/me/identity-operations/{id}/step-up/verify without mutation
replay.

func (c *Client) VerifyIdentityOperationWebAuthn(ctx context.Context, accessToken string, operationID string, request OperationWebAuthnVerify) (*IdentityOperation, error)
VerifyIdentityOperationWebAuthn calls POST
/api/v1/auth/me/identity-operations/{id}/step-up/webauthn/verify without
mutation replay.

func (c *Client) VerifyMFAOperationStepUp(ctx context.Context, accessToken string, operationID string, request OperationStepUpVerify) (*MFAOperation, error)
VerifyMFAOperationStepUp calls POST
/api/v1/auth/mfa/operations/{id}/step-up/verify without mutation replay.

func (c *Client) VerifyMFAOperationWebAuthn(ctx context.Context, accessToken string, operationID string, request OperationWebAuthnVerify) (*MFAOperation, error)
VerifyMFAOperationWebAuthn calls POST
/api/v1/auth/mfa/operations/{id}/step-up/webauthn/verify without mutation
replay.

type CreateOrganizationInvitationRequest struct {
Email string `json:"email"`
Role *OrganizationMemberRole `json:"role,omitempty"`
SendEmail *bool `json:"sendEmail,omitempty"`
}
CreateOrganizationInvitationRequest is the strict invitation create payload.

type CreateOrganizationRequest struct {
Name string `json:"name"`
Slug string `json:"slug"`
}
CreateOrganizationRequest is the strict Organization create payload.

type CreatePermissionRequest struct {
Resource string `json:"resource"`
Action string `json:"action"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
}
CreatePermissionRequest is the strict canonical permission create payload.

type CreateRegistrationGrantRequest struct {
Type CreateRegistrationGrantType `json:"type"`
DisplayName *string `json:"displayName,omitempty"`
AllowedEmail *string `json:"allowedEmail,omitempty"`
AllowedDomain *string `json:"allowedDomain,omitempty"`
ExpiresAt *string `json:"expiresAt,omitempty"`
MaxUses *int `json:"maxUses,omitempty"`
}
CreateRegistrationGrantRequest describes a manual EMAIL_LINK or ACCESS_CODE
grant.

type CreateRegistrationGrantType string
CreateRegistrationGrantType selects a manual EMAIL_LINK or ACCESS_CODE
grant.

const (
CreateRegistrationGrantEmailLink CreateRegistrationGrantType = "EMAIL_LINK"
CreateRegistrationGrantAccessCode CreateRegistrationGrantType = "ACCESS_CODE"
)
Supported CreateRegistrationGrantType wire values.

type CreateRoleRequest struct {
Key string `json:"key"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
}
CreateRoleRequest is the strict role create payload.

type CreateUserRoleRequest struct {
RoleID string `json:"roleId"`
Condition *UserRoleCondition `json:"condition,omitempty"`
}
CreateUserRoleRequest is the typed POST assignment payload.

type CreatedRegistrationGrant struct {
Grant RegistrationGrant `json:"grant"`
RegistrationGrantToken *string `json:"registrationGrantToken"`
RegistrationAccessCode *string `json:"registrationAccessCode"`
RegistrationInvitationURL *string `json:"registrationInvitationUrl"`
SecretAlreadyIssued bool `json:"secretAlreadyIssued"`
}
CreatedRegistrationGrant contains the one-time raw proof returned only by
create.

func (created *CreatedRegistrationGrant) UnmarshalJSON(data []byte) error
UnmarshalJSON validates explicit secret-delivery state and one-time proof
invariants.

type CurrentUser struct {
ID string `json:"id"`
Email *string `json:"email"`
Username *string `json:"username"`
Status string `json:"status"`
EmailVerified bool `json:"emailVerified"`
AuthenticationContext AuthenticationContext `json:"authenticationContext"`
Metadata map[string]json.RawMessage `json:"metadata"`
}
CurrentUser is the safe authenticated /me view. Metadata is never
authorization.

func ParseCurrentUser(data []byte) (*CurrentUser, error)
ParseCurrentUser rejects absent and malformed bindings; nullable fields must
be explicitly present.

type CurrentUserError struct{ Status int }
CurrentUserError exposes HTTP status without reflecting upstream
diagnostics.

func (e *CurrentUserError) Error() string

type EmailOTPReauthentication struct {
ChallengeID string `json:"challengeId"`
Code string `json:"code"`
}
EmailOTPReauthentication mirrors the current-user producer contract.

func (EmailOTPReauthentication) GoString() string
GoString returns a redacted Go-syntax representation.

func (r EmailOTPReauthentication) MarshalJSON() ([]byte, error)
MarshalJSON includes the required wire discriminator for this closed request
type.

func (EmailOTPReauthentication) String() string

type EmailVerificationResponse struct {
Message string `json:"message"`
RetryAfterSeconds *int `json:"retryAfterSeconds"`
}
EmailVerificationResponse is returned by public email verification helpers.

type FailMode int
FailMode controls how the SDK behaves when the permission resolver errors.

const (
// FailClose denies the request when resolution fails. Default.
FailClose FailMode = iota
// FailOpen allows the request through with an empty permission set.
FailOpen
)
type IdentifierAction string
IdentifierAction identifies a supported identifier mutation.

const (
IdentifierActionVerify IdentifierAction = "VERIFY"
IdentifierActionSetPrimary IdentifierAction = "SET_PRIMARY"
IdentifierActionRemove IdentifierAction = "REMOVE"
IdentifierActionReplace IdentifierAction = "REPLACE"
IdentifierActionTransfer IdentifierAction = "TRANSFER"
)
Supported IdentifierAction wire values.

type IdentifierCapability struct {
Allowed bool `json:"allowed"`
UnavailableReasons []IdentifierDenial `json:"unavailableReasons"`
Requirements []IdentifierRequirement `json:"requirements"`
ReplacementPrimaryIDs []string `json:"replacementPrimaryIds"`
}
IdentifierCapability is an authenticated advisory snapshot; every mutation
is revalidated.

type IdentifierDenial string
IdentifierDenial explains why an identifier capability is unavailable.

const (
IdentifierDenialAccountInactive IdentifierDenial = "ACCOUNT_INACTIVE"
IdentifierDenialManagedIdentifier IdentifierDenial = "MANAGED_IDENTIFIER"
IdentifierDenialMethodUnavailable IdentifierDenial = "METHOD_UNAVAILABLE"
IdentifierDenialReauthMethodUnavailable IdentifierDenial = "REAUTH_METHOD_UNAVAILABLE"
IdentifierDenialTargetProofUnavailable IdentifierDenial = "TARGET_PROOF_UNAVAILABLE"
IdentifierDenialIdentifierAlreadyExists IdentifierDenial = "IDENTIFIER_ALREADY_EXISTS"
IdentifierDenialNotApplicable IdentifierDenial = "NOT_APPLICABLE"
IdentifierDenialAlreadyVerified IdentifierDenial = "ALREADY_VERIFIED"
IdentifierDenialAlreadyPrimary IdentifierDenial = "ALREADY_PRIMARY"
IdentifierDenialIdentifierUnverified IdentifierDenial = "IDENTIFIER_UNVERIFIED"
IdentifierDenialIdentifierRangeRejected IdentifierDenial = "IDENTIFIER_RANGE_REJECTED"
IdentifierDenialLastLoginMethod IdentifierDenial = "LAST_LOGIN_METHOD"
IdentifierDenialPrimaryReplacementUnavailable IdentifierDenial = "PRIMARY_REPLACEMENT_UNAVAILABLE"
)
Supported IdentifierDenial wire values.

type IdentifierKind string
IdentifierKind is an operation wire enum; unsupported response values fail
closed.

const (
IdentifierKindUsername IdentifierKind = "USERNAME"
IdentifierKindEmail IdentifierKind = "EMAIL"
IdentifierKindPhone IdentifierKind = "PHONE"
)
Supported IdentifierKind wire values.

type IdentifierManagement struct {
Add map[IdentifierKind]IdentifierCapability `json:"add"`
ProofOptions []OperationProofOption `json:"proofOptions"`
}
IdentifierManagement is the authenticated identifier capability and proof
snapshot.

type IdentifierRequirement string
IdentifierRequirement names a required proof or remaining login path.

const (
IdentifierRequirementCurrentAccountProof IdentifierRequirement = "CURRENT_ACCOUNT_PROOF"
IdentifierRequirementNewIdentifier IdentifierRequirement = "NEW_IDENTIFIER"
IdentifierRequirementTargetEmailOtp IdentifierRequirement = "TARGET_EMAIL_OTP"
IdentifierRequirementTargetPhoneOtp IdentifierRequirement = "TARGET_PHONE_OTP"
IdentifierRequirementReplacementPrimary IdentifierRequirement = "REPLACEMENT_PRIMARY"
IdentifierRequirementRemoveOld IdentifierRequirement = "REMOVE_OLD"
IdentifierRequirementCounterpartConfirmation IdentifierRequirement = "COUNTERPART_CONFIRMATION"
IdentifierRequirementRemainingLoginPath IdentifierRequirement = "REMAINING_LOGIN_PATH"
)
Supported IdentifierRequirement wire values.

type IdentityChallengeResult struct {
Operation IdentityOperation `json:"operation"`
ChallengeID string `json:"challengeId"`
NextChallengeAt string `json:"nextChallengeAt"`
}
IdentityChallengeResult mirrors the current-user producer contract.

type IdentityOperation struct {
ID string `json:"id"`
Type IdentityOperationType `json:"type"`
State IdentityOperationState `json:"state"`
ExpiresAt string `json:"expiresAt"`
RequiredProofs []IdentityRequiredProof `json:"requiredProofs"`
Result map[string]string `json:"result,omitempty" wire:"optional"`
MaskedIdentifier *string `json:"maskedIdentifier,omitempty" wire:"optional"`
NextChallengeAt *string `json:"nextChallengeAt,omitempty" wire:"optional"`
Completion *OperationCompletion `json:"completion,omitempty" wire:"optional"`
ProofOptions []OperationProofOption `json:"proofOptions"`
ProviderTarget *ProviderTarget `json:"providerTarget,omitempty"`
}
IdentityOperation mirrors the current-user producer contract.

type IdentityOperationComplete struct {
Proofs []IdentityTargetProof `json:"proofs"`
}
IdentityOperationComplete mirrors the current-user producer contract.

func (IdentityOperationComplete) GoString() string
GoString returns a redacted Go-syntax representation.

func (IdentityOperationComplete) String() string

type IdentityOperationCreate struct {
ExpectedLoginMethodVersion int64 `json:"expectedLoginMethodVersion"`
Payload IdentityPayload `json:"payload"`
}
IdentityOperationCreate derives its discriminator from the closed payload
type.

func (r IdentityOperationCreate) MarshalJSON() ([]byte, error)
MarshalJSON includes the required wire discriminator for this closed request
type.

type IdentityOperationState string
IdentityOperationState is an operation wire enum; unsupported response
values fail closed.

const (
IdentityOperationStateAwaitingReauth IdentityOperationState = "AWAITING_REAUTH"
IdentityOperationStateAwaitingProof IdentityOperationState = "AWAITING_PROOF"
IdentityOperationStateReady IdentityOperationState = "READY"
IdentityOperationStateCommitted IdentityOperationState = "COMMITTED"
IdentityOperationStateCancelled IdentityOperationState = "CANCELLED"
IdentityOperationStateExpired IdentityOperationState = "EXPIRED"
IdentityOperationStateRejected IdentityOperationState = "REJECTED"
)
Supported IdentityOperationState wire values.

type IdentityOperationType string
IdentityOperationType is an operation wire enum; unsupported response values
fail closed.

const (
IdentityOperationTypeAdd IdentityOperationType = "ADD"
IdentityOperationTypeVerify IdentityOperationType = "VERIFY"
IdentityOperationTypeSetPrimary IdentityOperationType = "SET_PRIMARY"
IdentityOperationTypeRemove IdentityOperationType = "REMOVE"
IdentityOperationTypeReplace IdentityOperationType = "REPLACE"
IdentityOperationTypeLink IdentityOperationType = "LINK"
IdentityOperationTypeUnlink IdentityOperationType = "UNLINK"
IdentityOperationTypeTransfer IdentityOperationType = "TRANSFER"
IdentityOperationTypeAccountDelete IdentityOperationType = "ACCOUNT_DELETE"
)
Supported IdentityOperationType wire values.

type IdentityPayload interface {
// Has unexported methods.
}
IdentityPayload is a closed set of self-service identifier/provider
mutations.

type IdentityProviderAuthorize struct {
Purpose AuthorizationPurpose `json:"purpose"`
RedirectURI string `json:"redirectUri"`
CodeChallenge string `json:"codeChallenge"`
CodeChallengeMethod string `json:"codeChallengeMethod"`
MethodID *string `json:"methodId,omitempty" wire:"optional"`
}
IdentityProviderAuthorize mirrors the current-user producer contract.

type IdentityRequiredProof struct {
Purpose string `json:"purpose"`
Methods []string `json:"methods"`
Strength string `json:"strength"`
Satisfied bool `json:"satisfied"`
}
IdentityRequiredProof mirrors the current-user producer contract.

type IdentityTargetProof struct {
Method TargetProofMethod `json:"method"`
Code string `json:"code"`
}
IdentityTargetProof mirrors the current-user producer contract.

func (IdentityTargetProof) GoString() string
GoString returns a redacted Go-syntax representation.

func (r IdentityTargetProof) MarshalJSON() ([]byte, error)
MarshalJSON includes the required wire discriminator for this closed request
type.

func (IdentityTargetProof) String() string

type ImpersonationContext struct {
ActorID string `json:"actorId"`
ImpersonationID string `json:"impersonationId"`
}
ImpersonationContext identifies the actor and impersonation session.

type LinkIdentity struct {
ProviderID string `json:"providerId"`
}
LinkIdentity mirrors the current-user producer contract.

type LinkableIdentityProvider struct {
ID string `json:"id"`
ProviderType string `json:"providerType"`
Protocol string `json:"protocol"`
DisplayName string `json:"displayName"`
Enabled bool `json:"enabled"`
Linked bool `json:"linked"`
LinkedAt *string `json:"linkedAt,omitempty" wire:"optional"`
SupportsAccountLinking bool `json:"supportsAccountLinking"`
CanLink bool `json:"canLink"`
CanReauthenticate bool `json:"canReauthenticate"`
UnavailableReasons []string `json:"unavailableReasons"`
}
LinkableIdentityProvider mirrors the current-user producer contract.

type ListPermissionsResponse struct {
Permissions []PermissionDefinitionDTO `json:"permissions"`
}
ListPermissionsResponse is the response body for GET
/open/v1/apps/{cid}/permissions.

type LoginIdentifier struct {
Kind IdentifierKind `json:"kind"`
Value string `json:"value"`
Region *string `json:"region,omitempty" wire:"optional"`
}
LoginIdentifier mirrors the current-user producer contract.

type MFAAction struct {
Allowed bool `json:"allowed"`
ReasonCode *string `json:"reasonCode,omitempty" wire:"optional"`
ProofRequirement ProofRequirement `json:"proofRequirement"`
ProofOptions []OperationProofOption `json:"proofOptions"`
}
MFAAction mirrors the current-user producer contract.

type MFACapabilities struct {
LoginMethodVersion int64 `json:"loginMethodVersion"`
TOTPEnroll MFAAction `json:"totpEnroll"`
TOTPDisable MFAAction `json:"totpDisable"`
RecoveryCodesGenerate MFAAction `json:"recoveryCodesGenerate"`
}
MFACapabilities mirrors the current-user producer contract.

type MFAChallengeResult struct {
Operation MFAOperation `json:"operation"`
ChallengeID string `json:"challengeId"`
NextChallengeAt string `json:"nextChallengeAt"`
}
MFAChallengeResult mirrors the current-user producer contract.

type MFACompletionResult struct {
Operation MFAOperation `json:"operation"`
Delivery SensitiveDelivery `json:"delivery"`
RecoveryCodes *RecoveryCodes `json:"recoveryCodes,omitempty" wire:"optional"`
}
MFACompletionResult mirrors the current-user producer contract.

func (MFACompletionResult) GoString() string
GoString returns a redacted Go-syntax representation.

func (MFACompletionResult) String() string

type MFAOperation struct {
ID string `json:"id"`
Type MFAOperationType `json:"type"`
State MFAOperationState `json:"state"`
CreatedAt string `json:"createdAt"`
ExpiresAt string `json:"expiresAt"`
ExpectedLoginMethodVersion int64 `json:"expectedLoginMethodVersion"`
ProofRequirement ProofRequirement `json:"proofRequirement"`
ProofOptions []OperationProofOption `json:"proofOptions"`
ProofSatisfied bool `json:"proofSatisfied"`
NextChallengeAt *string `json:"nextChallengeAt,omitempty" wire:"optional"`
ReasonCode *string `json:"reasonCode,omitempty" wire:"optional"`
Result *MFAOperationResult `json:"result,omitempty" wire:"optional"`
}
MFAOperation mirrors the current-user producer contract.

type MFAOperationCreate struct {
Type MFAOperationType `json:"type"`
ExpectedLoginMethodVersion int64 `json:"expectedLoginMethodVersion"`
}
MFAOperationCreate mirrors the current-user producer contract.

type MFAOperationResult struct {
CompletedAt string `json:"completedAt"`
FinalLoginMethodVersion int64 `json:"finalLoginMethodVersion"`
SessionImpact SessionImpact `json:"sessionImpact"`
RecoveryBatchID *string `json:"recoveryBatchId,omitempty" wire:"optional"`
RecoveryCount *int64 `json:"recoveryCount,omitempty" wire:"optional"`
}
MFAOperationResult mirrors the current-user producer contract.

type MFAOperationState string
MFAOperationState is an operation wire enum; unsupported response values
fail closed.

const (
MFAOperationStateAwaitingReauth MFAOperationState = "AWAITING_REAUTH"
MFAOperationStateReady MFAOperationState = "READY"
MFAOperationStateAwaitingConfirmation MFAOperationState = "AWAITING_CONFIRMATION"
MFAOperationStateCommitted MFAOperationState = "COMMITTED"
MFAOperationStateCancelled MFAOperationState = "CANCELLED"
MFAOperationStateExpired MFAOperationState = "EXPIRED"
)
Supported MFAOperationState wire values.

type MFAOperationType string
MFAOperationType is an operation wire enum; unsupported response values fail
closed.

const (
MFAOperationTypeTOTPEnroll MFAOperationType = "TOTP_ENROLL"
MFAOperationTypeTOTPDisable MFAOperationType = "TOTP_DISABLE"
MFAOperationTypeRecoveryCodesGenerate MFAOperationType = "RECOVERY_CODES_GENERATE"
)
Supported MFAOperationType wire values.

type MFAProviderAuthorize struct {
MethodID string `json:"methodId"`
RedirectURI string `json:"redirectUri"`
CodeChallenge string `json:"codeChallenge"`
CodeChallengeMethod string `json:"codeChallengeMethod"`
}
MFAProviderAuthorize mirrors the current-user producer contract.

type OperationCompletion struct {
CompletedAt string `json:"completedAt"`
FinalLoginMethodVersion int64 `json:"finalLoginMethodVersion"`
SessionImpact SessionImpact `json:"sessionImpact"`
}
OperationCompletion mirrors the current-user producer contract.

type OperationProofOption struct {
Method ProofMethod `json:"method"`
IdentifierID *string `json:"identifierId,omitempty" wire:"optional"`
MaskedIdentifier *string `json:"maskedIdentifier,omitempty" wire:"optional"`
MethodID *string `json:"methodId,omitempty" wire:"optional"`
DisplayName *string `json:"displayName,omitempty" wire:"optional"`
AvailableMethods []string `json:"availableMethods,omitempty" wire:"optional"`
}
OperationProofOption mirrors the current-user producer contract.

type OperationStepUpChallenge struct {
ChallengeID string `json:"challengeId"`
AvailableMethods []string `json:"availableMethods"`
}
OperationStepUpChallenge mirrors the current-user producer contract.

type OperationStepUpVerify struct {
ChallengeID string `json:"challengeId"`
Code string `json:"code"`
}
OperationStepUpVerify mirrors the current-user producer contract.

func (OperationStepUpVerify) GoString() string
GoString returns a redacted Go-syntax representation.

func (OperationStepUpVerify) String() string

type OperationWebAuthnStart struct {
RequestID string `json:"requestId"`
PublicKey string `json:"publicKey"`
}
OperationWebAuthnStart mirrors the current-user producer contract.

type OperationWebAuthnVerify struct {
ChallengeID string `json:"challengeId"`
RequestID string `json:"requestId"`
Credential string `json:"credential"`
}
OperationWebAuthnVerify mirrors the current-user producer contract.

func (OperationWebAuthnVerify) GoString() string
GoString returns a redacted Go-syntax representation.

func (OperationWebAuthnVerify) String() string

type Organization struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Version int64 `json:"version"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
ETag string `json:"-"`
}
Organization is an Application-bound Organization. ETag is populated for
create, get, and update responses.

type OrganizationCreateOptions struct {
IdempotencyKey string
}
OrganizationCreateOptions carries an optional Idempotency-Key for
exactly-once creates.

type OrganizationIfMatchOptions struct {
IfMatch string
}
OrganizationIfMatchOptions carries an optional quoted ETag/version
precondition.

type OrganizationInvitation struct {
ID string `json:"id"`
Email string `json:"email"`
Role OrganizationMemberRole `json:"role"`
Status OrganizationInvitationStatus `json:"status"`
DeliveryStatus OrganizationInvitationDeliveryStatus `json:"deliveryStatus"`
ExpiresAt string `json:"expiresAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
OrganizationInvitation is a safe invitation detail. It never contains a
redemption proof.

type OrganizationInvitationDeliveryStatus string
OrganizationInvitationDeliveryStatus is the invitation email delivery
outcome.

const (
OrganizationInvitationDeliveryNotRequested OrganizationInvitationDeliveryStatus = "NOT_REQUESTED"
OrganizationInvitationDeliverySent OrganizationInvitationDeliveryStatus = "SENT"
OrganizationInvitationDeliveryFailed OrganizationInvitationDeliveryStatus = "FAILED"
)
Supported OrganizationInvitationDeliveryStatus wire values.

type OrganizationInvitationListOptions struct {
Status *OrganizationInvitationStatus
Page *int
Size *int
}
OrganizationInvitationListOptions filters invitation lifecycle state and
pages results.

type OrganizationInvitationPage struct {
Content []OrganizationInvitation `json:"content"`
Page OrganizationPageMetadata `json:"page"`
}
OrganizationInvitationPage is a page of invitation details and delivery
states.

type OrganizationInvitationStatus string
OrganizationInvitationStatus is an Organization invitation lifecycle state.

const (
OrganizationInvitationPending OrganizationInvitationStatus = "PENDING"
OrganizationInvitationAccepted OrganizationInvitationStatus = "ACCEPTED"
OrganizationInvitationCancelled OrganizationInvitationStatus = "CANCELLED"
OrganizationInvitationExpired OrganizationInvitationStatus = "EXPIRED"
)
Supported OrganizationInvitationStatus wire values.

type OrganizationListOptions struct {
Search *string
Page *int
Size *int
Sort []string
Direction []OrganizationSortDirection
}
OrganizationListOptions filters, pages, and sorts Organization results.

type OrganizationMember struct {
MembershipID string `json:"membershipId"`
UserID string `json:"userId"`
Email string `json:"email"`
DisplayName string `json:"displayName"`
Role OrganizationMemberRole `json:"role"`
JoinedAt string `json:"joinedAt"`
UpdatedAt string `json:"updatedAt"`
Version int64 `json:"version"`
}
OrganizationMember is an Organization membership detail, including its
optimistic-lock version.

type OrganizationMemberListOptions struct {
Search *string
Page *int
Size *int
}
OrganizationMemberListOptions filters and pages Organization members.

type OrganizationMemberPage struct {
Content []OrganizationMember `json:"content"`
Page OrganizationPageMetadata `json:"page"`
}
OrganizationMemberPage is a page of Organization membership details.

type OrganizationMemberRole string
OrganizationMemberRole is the Organization role returned and accepted by the
Open API.

const (
OrganizationMemberRoleOwner OrganizationMemberRole = "OWNER"
OrganizationMemberRoleAdmin OrganizationMemberRole = "ADMIN"
OrganizationMemberRoleMember OrganizationMemberRole = "MEMBER"
)
Supported OrganizationMemberRole wire values.

type OrganizationPage struct {
Content []Organization `json:"content"`
Page OrganizationPageMetadata `json:"page"`
}
OrganizationPage is a page of Application-bound Organizations.

type OrganizationPageMetadata struct {
Size int `json:"size"`
Number int `json:"number"`
TotalElements int64 `json:"totalElements"`
TotalPages int `json:"totalPages"`
}
OrganizationPageMetadata is the nested Spring PagedModel metadata.

type OrganizationSortDirection string
OrganizationSortDirection controls Organization list sorting.

const (
OrganizationSortAscending OrganizationSortDirection = "ASC"
OrganizationSortDescending OrganizationSortDirection = "DESC"
)
Supported OrganizationSortDirection wire values.

type OrganizationSwitchResponse struct {
OrganizationID string `json:"organizationId"`
Continuation string `json:"continuation"`
TokenRefreshRequired bool `json:"tokenRefreshRequired"`
Message string `json:"message,omitempty"`
}
OrganizationSwitchResponse is returned after requesting a current
Organization switch.

type PasswordChangeRequest struct {
CurrentPassword string `json:"currentPassword"`
NewPassword string `json:"newPassword"`
}
PasswordChangeRequest is the authenticated password-change body.

type PasswordReauthentication struct {
Password string `json:"password"`
}
PasswordReauthentication mirrors the current-user producer contract.

func (PasswordReauthentication) GoString() string
GoString returns a redacted Go-syntax representation.

func (r PasswordReauthentication) MarshalJSON() ([]byte, error)
MarshalJSON includes the required wire discriminator for this closed request
type.

func (PasswordReauthentication) String() string

type Permission struct {
ID string `json:"id"`
Resource string `json:"resource"`
Action string `json:"action"`
Key string `json:"key"`
Name string `json:"name"`
Description *string `json:"description"`
Source string `json:"source"`
Version int64 `json:"version"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
ETag string `json:"-"`
}
Permission is a canonical resource:action grant and its response ETag.

type PermissionCheckResponse struct {
ApplicationID string `json:"applicationId"`
OrganizationID string `json:"organizationId,omitempty"`
Permission string `json:"permission"`
Allowed bool `json:"allowed"`
Roles []string `json:"roles"`
}
PermissionCheckResponse is returned by current-user permission checks.

type PermissionDefinitionDTO struct {
Resource string `json:"resource"`
Action string `json:"action"`
Description string `json:"description,omitempty"`
}
PermissionDefinitionDTO mirrors the request/response shape used by the
/open/v1/apps/{cid}/permissions endpoints. It is intentionally duplicated
here (rather than imported from authz) to keep the client package free of
circular dependencies.

type PermissionManifest struct {
ManifestID string `json:"manifestId"`
Revision string `json:"revision"`
Permissions []PermissionManifestDeclaration `json:"permissions"`
}
PermissionManifest is a versioned set of structured permission declarations.

type PermissionManifestClient struct {
// Has unexported fields.
}
PermissionManifestClient executes structured manifests with an
instance-local machine-token cache.

func NewPermissionManifestClient(cfg PermissionManifestClientConfig) (*PermissionManifestClient, error)
NewPermissionManifestClient validates explicit endpoints and bounded retry
settings.

func (c *PermissionManifestClient) ClearPermissionManifestTokenCache()
ClearPermissionManifestTokenCache invalidates the instance's cached machine
token.

func (c *PermissionManifestClient) UpsertPermissionManifest(ctx context.Context, manifest PermissionManifest, idempotencyKey string) (*PermissionManifestResult, error)
UpsertPermissionManifest applies a manifest using an explicit idempotency
key.

func (c *PermissionManifestClient) ValidatePermissionManifest(ctx context.Context, manifest PermissionManifest) (*PermissionManifestResult, error)
ValidatePermissionManifest checks a manifest without applying changes.

type PermissionManifestClientConfig struct {
IssuerEndpoint string
PortalAPIEndpoint string
ClientID string
ClientSecret string
Timeout time.Duration
TokenSkew time.Duration
MaxRetries int
MaxRetryDelay time.Duration
HTTPClient *http.Client
Observer func(PermissionManifestObservation)
}
PermissionManifestClientConfig configures explicit issuer and Portal
endpoints and bounded command retries.

type PermissionManifestContinueEvent struct {
Mode string
Outcome string
Status int
Code string
}
PermissionManifestContinueEvent reports a sanitized development startup
failure.

type PermissionManifestCounts struct {
Created int `json:"created"`
Updated int `json:"updated"`
Unchanged int `json:"unchanged"`
Resurrected int `json:"resurrected"`
Conflict int `json:"conflict"`
Drift int `json:"drift"`
}
PermissionManifestCounts summarizes synchronization decisions and drift.

type PermissionManifestDeclaration struct {
Resource string `json:"resource"`
Action string `json:"action"`
Name string `json:"name"`
Description *string `json:"description"`
}
PermissionManifestDeclaration declares one concrete permission and its
display metadata.

func (d PermissionManifestDeclaration) Key() string
Key returns the exact resource:action permission key.

type PermissionManifestDrift struct {
Key string `json:"key"`
Kind string `json:"kind"`
Source string `json:"source"`
}
PermissionManifestDrift describes a difference between a declaration and
server state.

type PermissionManifestError struct {
Status int
Code string
Message string
CorrelationID string
RetryAfterSeconds int
Body string
}
PermissionManifestError exposes the manifest protocol's stable error
details.

func (e *PermissionManifestError) Error() string

type PermissionManifestFailurePolicy int
PermissionManifestFailurePolicy selects explicit failure handling for
development startup.

const (
PermissionManifestFailurePolicyUnset PermissionManifestFailurePolicy = iota
PermissionManifestFailFast
PermissionManifestContinue
)
Supported PermissionManifestFailurePolicy values.

type PermissionManifestItem struct {
Key string `json:"key"`
Operation string `json:"operation"`
Reason string `json:"reason"`
}
PermissionManifestItem describes a synchronization decision for one
permission key.

type PermissionManifestMode string
PermissionManifestMode selects validation-only or applied synchronization.

const (
PermissionManifestValidate PermissionManifestMode = "validate"
PermissionManifestUpsert PermissionManifestMode = "upsert"
)
Supported PermissionManifestMode values.

type PermissionManifestObservation struct {
Mode PermissionManifestMode
Outcome string
Status int
Duration time.Duration
}
PermissionManifestObservation reports a sanitized command outcome without
tokens or response bodies.

type PermissionManifestResult struct {
Mode PermissionManifestMode `json:"mode"`
ManifestID string `json:"manifestId"`
Revision string `json:"revision"`
Fingerprint string `json:"fingerprint"`
Applied bool `json:"applied"`
Results []PermissionManifestItem `json:"results"`
Drift []PermissionManifestDrift `json:"drift"`
Counts PermissionManifestCounts `json:"counts"`
}
PermissionManifestResult is the validated response from a manifest command.

type PermissionManifestStartupMode int
PermissionManifestStartupMode selects whether and when a startup command is
attempted.

const (
PermissionManifestDisabled PermissionManifestStartupMode = iota
PermissionManifestCIValidate
PermissionManifestDeploymentUpsert
PermissionManifestDevelopmentStartup
)
Supported PermissionManifestStartupMode values.

type PermissionManifestStartupOptions struct {
Mode PermissionManifestStartupMode
FailurePolicy PermissionManifestFailurePolicy
IdempotencyKey string
OnContinueError func(PermissionManifestContinueEvent)
}
PermissionManifestStartupOptions configures startup mode, idempotency and
continued-error reporting.

type PermissionManifestStartupResult struct {
NetworkAttempted bool
Continued bool
Result *PermissionManifestResult
}
PermissionManifestStartupResult records whether a startup command was
attempted or continued.

func RunPermissionManifestStartup(ctx context.Context, client *PermissionManifestClient, manifest PermissionManifest, options PermissionManifestStartupOptions) (PermissionManifestStartupResult, error)
RunPermissionManifestStartup executes only the configured startup mode and
explicit failure policy.

type PermissionPage struct {
Content []Permission `json:"content"`
Page AuthorizationPageMetadata `json:"page"`
}
PermissionPage is a deterministic page of permissions.

type PortalOpenAPIClient struct {
// Has unexported fields.
}
PortalOpenAPIClient is a server-side M2M client for iam-portal /open/v1/**.

It obtains client_credentials machine tokens with explicit
portal:openapi:read or portal:openapi:write scope, caches read/write tokens
separately, and sends only Authorization: Bearer <machine_token> to Portal
resource endpoints.

func NewPortalOpenAPIClient(cfg PortalOpenAPIClientConfig) (*PortalOpenAPIClient, error)
NewPortalOpenAPIClient constructs a server-side confidential Portal Open API
client.

func (c *PortalOpenAPIClient) CancelOrganizationInvitation(ctx context.Context, organizationID, invitationID string) error
CancelOrganizationInvitation uses only organization_invitations:write.
Portal owns terminal-state/idempotency semantics.

func (c *PortalOpenAPIClient) ClearTokenCache(scopes ...PortalOpenAPIScope)
ClearTokenCache clears cached read/write tokens, or only one scope when
provided.

func (c *PortalOpenAPIClient) CreateOrganization(ctx context.Context, request CreateOrganizationRequest, options *OrganizationCreateOptions) (*Organization, error)
CreateOrganization uses only organizations:write and applies Idempotency-Key
when supplied.

func (c *PortalOpenAPIClient) CreateOrganizationInvitation(ctx context.Context, organizationID string, request CreateOrganizationInvitationRequest, options *OrganizationCreateOptions) (*OrganizationInvitation, error)
CreateOrganizationInvitation uses only organization_invitations:write and
applies Idempotency-Key when supplied.

func (c *PortalOpenAPIClient) CreatePermission(ctx context.Context, req CreatePermissionRequest, options *AuthorizationCreateOptions) (*Permission, error)
CreatePermission uses only permissions:write and validates canonical grant
grammar.

func (c *PortalOpenAPIClient) CreateRegistrationGrant(ctx context.Context, request CreateRegistrationGrantRequest, idempotencyKey string) (*CreatedRegistrationGrant, error)
CreateRegistrationGrant creates an EMAIL_LINK or ACCESS_CODE grant with
exactly one matching proof.

func (c *PortalOpenAPIClient) CreateRole(ctx context.Context, req CreateRoleRequest, options *AuthorizationCreateOptions) (*Role, error)
CreateRole uses only roles:write and applies Idempotency-Key when supplied.

func (c *PortalOpenAPIClient) CreateUserRole(ctx context.Context, userID string, req CreateUserRoleRequest, options *AuthorizationCreateOptions) (*UserRoleAssignment, error)
CreateUserRole uses only user_roles:write and the typed POST assignment
route.

func (c *PortalOpenAPIClient) DeleteOrganization(ctx context.Context, organizationID string, options *OrganizationIfMatchOptions) error
DeleteOrganization uses only organizations:write and applies If-Match when
supplied.

func (c *PortalOpenAPIClient) DeletePermission(ctx context.Context, id, ifMatch string) error
DeletePermission uses only permissions:write and requires a strong If-Match
ETag.

func (c *PortalOpenAPIClient) DeleteRole(ctx context.Context, id, ifMatch string) error
DeleteRole uses only roles:write and requires a strong If-Match ETag.

func (c *PortalOpenAPIClient) DeleteUserRole(ctx context.Context, userID, assignmentID, ifMatch string) error
DeleteUserRole uses only user_roles:write and requires If-Match.

func (c *PortalOpenAPIClient) DeliverRegistrationGrant(ctx context.Context, grantID string, request RegistrationGrantDeliveryRequest, idempotencyKey string) (*RegistrationGrantDelivery, error)
DeliverRegistrationGrant queues one email using registration_grants:write.

func (c *PortalOpenAPIClient) GetMachineToken(ctx context.Context, scope PortalOpenAPIScope) (*PortalOpenAPIMachineToken, error)
GetMachineToken returns a cached or freshly requested machine token for an
explicit scope.

func (c *PortalOpenAPIClient) GetOrganization(ctx context.Context, organizationID string) (*Organization, error)
GetOrganization uses only organizations:read and exposes the returned ETag.

func (c *PortalOpenAPIClient) GetOrganizationInvitation(ctx context.Context, organizationID, invitationID string) (*OrganizationInvitation, error)
GetOrganizationInvitation uses only organization_invitations:read.

func (c *PortalOpenAPIClient) GetOrganizationMember(ctx context.Context, organizationID, membershipID string) (*OrganizationMember, error)
GetOrganizationMember uses only organization_members:read.

func (c *PortalOpenAPIClient) GetPermission(ctx context.Context, id string) (*Permission, error)
GetPermission uses only permissions:read and exposes the returned ETag.

func (c *PortalOpenAPIClient) GetRegistrationGrant(ctx context.Context, grantID string) (*RegistrationGrant, error)
GetRegistrationGrant returns a safe grant detail using
registration_grants:read.

func (c *PortalOpenAPIClient) GetRegistrationGrantDelivery(ctx context.Context, grantID, deliveryID string) (*RegistrationGrantDelivery, error)
GetRegistrationGrantDelivery reads authoritative status using
registration_grants:read.

func (c *PortalOpenAPIClient) GetRole(ctx context.Context, id string) (*Role, error)
GetRole uses only roles:read and exposes the returned ETag.

func (c *PortalOpenAPIClient) ListOrganizationInvitations(ctx context.Context, organizationID string, options OrganizationInvitationListOptions) (*OrganizationInvitationPage, error)
ListOrganizationInvitations uses only organization_invitations:read.

func (c *PortalOpenAPIClient) ListOrganizationMembers(ctx context.Context, organizationID string, options OrganizationMemberListOptions) (*OrganizationMemberPage, error)
ListOrganizationMembers uses only organization_members:read.

func (c *PortalOpenAPIClient) ListOrganizations(ctx context.Context, options OrganizationListOptions) (*OrganizationPage, error)
ListOrganizations uses only organizations:read.

func (c *PortalOpenAPIClient) ListPermissions(ctx context.Context, options AuthorizationPageOptions) (*PermissionPage, error)
ListPermissions uses only permissions:read.

func (c *PortalOpenAPIClient) ListRegistrationGrantRedemptions(ctx context.Context, grantID string, page, size *int) (*RegistrationGrantRedemptionPage, error)
ListRegistrationGrantRedemptions lists masked history using its dedicated
exact scope.

func (c *PortalOpenAPIClient) ListRegistrationGrants(ctx context.Context, options RegistrationGrantListOptions) (*RegistrationGrantPage, error)
ListRegistrationGrants lists grants using only registration_grants:read.

func (c *PortalOpenAPIClient) ListRolePermissions(ctx context.Context, roleID string, options AuthorizationPageOptions) (*RolePermissionBindingPage, error)
ListRolePermissions uses only role_permissions:read and exposes the role
ETag.

func (c *PortalOpenAPIClient) ListRoles(ctx context.Context, options AuthorizationPageOptions) (*RolePage, error)
ListRoles uses only roles:read.

func (c *PortalOpenAPIClient) ListUserRoles(ctx context.Context, userID string, options AuthorizationPageOptions) (*UserRoleAssignmentPage, error)
ListUserRoles uses only user_roles:read.

func (c *PortalOpenAPIClient) PauseRegistrationGrant(ctx context.Context, grantID string) (*RegistrationGrant, error)
PauseRegistrationGrant pauses a grant using registration_grants:write.

func (c *PortalOpenAPIClient) RemoveOrganizationMember(ctx context.Context, organizationID, membershipID string) error
RemoveOrganizationMember uses only organization_members:write. Last-owner
conflicts remain typed Portal errors.

func (c *PortalOpenAPIClient) ReplaceRolePermissions(ctx context.Context, roleID string, permissionIDs []string, ifMatch string) (*RolePermissionSet, error)
ReplaceRolePermissions uses only role_permissions:write and requires
If-Match.

func (c *PortalOpenAPIClient) RequestJSON(ctx context.Context, method, path string, body any, out any) error
RequestJSON calls a Portal /open/v1/** JSON endpoint with a bearer machine
token.

GET uses portal:openapi:read. POST, PUT, PATCH, and DELETE use
portal:openapi:write. The resource request never sends Basic auth,
X-IAM-Client-Id, X-Application-Id, or X-App-Key.

func (c *PortalOpenAPIClient) ResendOrganizationInvitation(ctx context.Context, organizationID, invitationID string) (*OrganizationInvitation, error)
ResendOrganizationInvitation uses only organization_invitations:write.
Retry-After is preserved on PortalOpenAPIError.

func (c *PortalOpenAPIClient) ResumeRegistrationGrant(ctx context.Context, grantID string) (*RegistrationGrant, error)
ResumeRegistrationGrant resumes a grant using registration_grants:write.

func (c *PortalOpenAPIClient) RevokeRegistrationGrant(ctx context.Context, grantID string, reason *string) (*RegistrationGrant, error)
RevokeRegistrationGrant revokes a grant using registration_grants:write.
Reason is optional.

func (c *PortalOpenAPIClient) RotateRegistrationGrant(ctx context.Context, grantID string, expectedVersion int64, idempotencyKey string) (*CreatedRegistrationGrant, error)
RotateRegistrationGrant rotates the last observed version without
automatically retrying.

func (c *PortalOpenAPIClient) UpdateOrganization(ctx context.Context, organizationID string, request UpdateOrganizationRequest, options *OrganizationIfMatchOptions) (*Organization, error)
UpdateOrganization uses only organizations:write and applies If-Match when
supplied.

func (c *PortalOpenAPIClient) UpdateOrganizationMemberRole(ctx context.Context, organizationID, membershipID string, role OrganizationMemberRole, options *OrganizationIfMatchOptions) (*OrganizationMember, error)
UpdateOrganizationMemberRole uses only organization_members:write and
applies If-Match when supplied.

func (c *PortalOpenAPIClient) UpdatePermission(ctx context.Context, id string, req UpdatePermissionRequest, ifMatch string) (*Permission, error)
UpdatePermission uses only permissions:write and requires a strong If-Match
ETag.

func (c *PortalOpenAPIClient) UpdateRole(ctx context.Context, id string, req UpdateRoleRequest, ifMatch string) (*Role, error)
UpdateRole uses only roles:write and requires a strong If-Match ETag.

func (c *PortalOpenAPIClient) UpdateUserRole(ctx context.Context, userID, assignmentID string, req UpdateUserRoleRequest, ifMatch string) (*UserRoleAssignment, error)
UpdateUserRole uses only user_roles:write and requires If-Match.

type PortalOpenAPIClientConfig struct {
// Issuer is the IAM issuer/auth server base URL. Tokens are requested from
// {Issuer}/oauth2/token.
Issuer string
// PortalEndpoint is the iam-portal base URL used for /open/v1/** resource requests.
PortalEndpoint string
// ClientID is the M2M confidential ApplicationClient.clientId.
ClientID string
// ClientSecret is the M2M confidential ApplicationClient secret. Never expose
// it to browser or native client code.
ClientSecret string
// Timeout is applied when HTTPClient is nil. Default 5s.
Timeout time.Duration
// TokenSkew is subtracted from expires_in before caching. Default 30s.
TokenSkew time.Duration
// HTTPClient optionally overrides the HTTP transport. If nil, a client with
// Timeout is created.
HTTPClient *http.Client
}
PortalOpenAPIClientConfig configures the server-side confidential client for
iam-portal /open/v1/** requests.

type PortalOpenAPIError struct {
Status int
Code string
Body string
RetryAfter string
}
PortalOpenAPIError describes a failed Portal /open/v1/** resource request.

func (e *PortalOpenAPIError) Error() string

func (e *PortalOpenAPIError) Unwrap() error
Unwrap lets callers use errors.Is(err, ErrPortalOpenAPIRequest).

type PortalOpenAPIMachineToken struct {
AccessToken string
Scope PortalOpenAPIScope
ExpiresAt time.Time
}
PortalOpenAPIMachineToken is a cached machine token for one explicit scope.

type PortalOpenAPIScope string
PortalOpenAPIScope is one of the explicit M2M scopes supported by
iam-portal.

const (
// PortalOpenAPIReadScope is the explicit client_credentials scope for read calls.
PortalOpenAPIReadScope PortalOpenAPIScope = "portal:openapi:read"
// PortalOpenAPIWriteScope is the explicit client_credentials scope for write calls.
PortalOpenAPIWriteScope PortalOpenAPIScope = "portal:openapi:write"
// RegistrationGrantsReadScope is required for registration-grant list and detail requests.
RegistrationGrantsReadScope PortalOpenAPIScope = "registration_grants:read"
// RegistrationGrantsWriteScope is required for registration-grant create and lifecycle requests.
RegistrationGrantsWriteScope PortalOpenAPIScope = "registration_grants:write"
// RegistrationGrantsRedemptionsReadScope is required for redemption-history requests.
RegistrationGrantsRedemptionsReadScope PortalOpenAPIScope = "registration_grants:redemptions:read"
// OrganizationsReadScope is required for Organization list and detail requests.
OrganizationsReadScope PortalOpenAPIScope = "organizations:read"
// OrganizationsWriteScope is required for Organization create, update, and delete requests.
OrganizationsWriteScope PortalOpenAPIScope = "organizations:write"
// OrganizationInvitationsReadScope is required for Organization invitation list and detail requests.
OrganizationInvitationsReadScope PortalOpenAPIScope = "organization_invitations:read"
// OrganizationInvitationsWriteScope is required for Organization invitation lifecycle requests.
OrganizationInvitationsWriteScope PortalOpenAPIScope = "organization_invitations:write"
// OrganizationMembersReadScope is required for Organization member list and detail requests.
OrganizationMembersReadScope PortalOpenAPIScope = "organization_members:read"
// OrganizationMembersWriteScope is required for Organization member role and removal requests.
OrganizationMembersWriteScope PortalOpenAPIScope = "organization_members:write"
// RolesReadScope is required for role list and detail requests.
RolesReadScope PortalOpenAPIScope = "roles:read"
// RolesWriteScope is required for role lifecycle requests.
RolesWriteScope PortalOpenAPIScope = "roles:write"
// PermissionsReadScope is required for permission list and detail requests.
PermissionsReadScope PortalOpenAPIScope = "permissions:read"
// PermissionsWriteScope is required for permission lifecycle requests.
PermissionsWriteScope PortalOpenAPIScope = "permissions:write"
// RolePermissionsReadScope is required for role binding list requests.
RolePermissionsReadScope PortalOpenAPIScope = "role_permissions:read"
// RolePermissionsWriteScope is required for role binding replacement.
RolePermissionsWriteScope PortalOpenAPIScope = "role_permissions:write"
// UserRolesReadScope is required for user assignment list requests.
UserRolesReadScope PortalOpenAPIScope = "user_roles:read"
// UserRolesWriteScope is required for user assignment lifecycle requests.
UserRolesWriteScope PortalOpenAPIScope = "user_roles:write"
)
type PortalOpenAPITokenError struct {
Status int
Code string
Body string
}
PortalOpenAPITokenError describes a failed /oauth2/token request or invalid
token response.

func (e *PortalOpenAPITokenError) Error() string

func (e *PortalOpenAPITokenError) Unwrap() error
Unwrap lets callers use errors.Is(err, ErrPortalOpenAPIToken).

type PreparedPermissionManifest struct {
Mode PermissionManifestMode `json:"mode"`
ManifestID string `json:"manifestId"`
Revision string `json:"revision"`
Fingerprint string `json:"fingerprint"`
Permissions []PermissionManifestDeclaration `json:"permissions"`
}
PreparedPermissionManifest contains validated, sorted declarations and their
canonical fingerprint.

func PreparePermissionManifest(manifest PermissionManifest, mode PermissionManifestMode) (PreparedPermissionManifest, error)
PreparePermissionManifest validates declarations and computes their sorted
canonical fingerprint.

type ProofMethod string
ProofMethod is an operation wire enum; unsupported response values fail
closed.

const (
ProofMethodPassword ProofMethod = "PASSWORD"
ProofMethodEmailOTP ProofMethod = "EMAIL_OTP"
ProofMethodProvider ProofMethod = "PROVIDER"
ProofMethodStepUpProof ProofMethod = "STEP_UP_PROOF"
)
Supported ProofMethod wire values.

type ProofRequirement string
ProofRequirement is an operation wire enum; unsupported response values fail
closed.

const (
ProofRequirementSession ProofRequirement = "SESSION"
ProofRequirementReauthentication ProofRequirement = "REAUTHENTICATION"
ProofRequirementStepUp ProofRequirement = "STEP_UP"
)
Supported ProofRequirement wire values.

type ProviderAuthorization struct {
AuthorizationID string `json:"authorizationId"`
AuthorizationURL string `json:"authorizationUrl"`
ExpiresAt string `json:"expiresAt"`
}
ProviderAuthorization mirrors the current-user producer contract.

type ProviderExchange struct {
AuthorizationID string `json:"authorizationId"`
CodeVerifier string `json:"codeVerifier"`
}
ProviderExchange mirrors the current-user producer contract.

func (ProviderExchange) GoString() string
GoString returns a redacted Go-syntax representation.

func (ProviderExchange) String() string

type ProviderTarget struct {
ProviderID string `json:"providerId"`
MaskedDisplayName *string `json:"maskedDisplayName,omitempty"`
MaskedEmail *string `json:"maskedEmail,omitempty"`
Reference string `json:"reference"`
}
ProviderTarget is the masked provider identity offered by the producer.

type PublicOrganizationInvitationAcceptResponse struct {
Status string `json:"status"`
Continuation string `json:"continuation,omitempty"`
ApplicationID string `json:"applicationId"`
OrganizationID string `json:"organizationId"`
OrganizationName string `json:"organizationName"`
Role string `json:"role"`
AcceptedAt string `json:"acceptedAt,omitempty"`
}
PublicOrganizationInvitationAcceptResponse is the invitation accept result.

type PublicOrganizationInvitationPreview struct {
ApplicationID string `json:"applicationId"`
ApplicationName string `json:"applicationName"`
OrganizationID string `json:"organizationId"`
OrganizationName string `json:"organizationName"`
InviteeEmail string `json:"inviteeEmail"`
Role string `json:"role"`
Status string `json:"status"`
ExpiresAt string `json:"expiresAt"`
}
PublicOrganizationInvitationPreview is the safe public invitation preview.

type Reauthentication interface {
// Has unexported methods.
}
Reauthentication cannot carry unrelated fields or a generic step-up grant.

type RecoveryCodes struct {
Codes []string `json:"codes"`
Count int64 `json:"count"`
}
RecoveryCodes mirrors the current-user producer contract.

func (RecoveryCodes) GoString() string
GoString returns a redacted Go-syntax representation.

func (RecoveryCodes) String() string

type RecoveryCodesRemaining struct {
Remaining int64 `json:"remaining"`
}
RecoveryCodesRemaining is the current unused count, not generation-time
delivery.

type RegistrationGrant struct {
ID string `json:"id"`
Version int64 `json:"version"`
Type RegistrationGrantType `json:"type"`
Status RegistrationGrantStatus `json:"status"`
DisplayName *string `json:"displayName"`
AllowedEmail *string `json:"allowedEmail"`
AllowedDomain *string `json:"allowedDomain"`
ExpiresAt *string `json:"expiresAt"`
MaxUses *int `json:"maxUses"`
UsedCount int `json:"usedCount"`
SourceType string `json:"sourceType"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
RevokedAt *string `json:"revokedAt"`
RevokeReason *string `json:"revokeReason"`
}
RegistrationGrant is a safe grant detail. It never contains a raw proof.

func (grant *RegistrationGrant) UnmarshalJSON(data []byte) error
UnmarshalJSON validates the required nonnegative grant version.

type RegistrationGrantDelivery struct {
ID string `json:"id"`
GrantID string `json:"grantId"`
Recipient string `json:"recipient"`
Variant string `json:"variant"`
Status string `json:"status"`
FailureCode *string `json:"failureCode"`
AttemptCount int `json:"attemptCount"`
MaxAttempts *int `json:"maxAttempts"`
NextAttemptAt *string `json:"nextAttemptAt"`
Retryable bool `json:"retryable"`
ExpiresAt string `json:"expiresAt"`
CreatedAt string `json:"createdAt"`
}
RegistrationGrantDelivery is safe status, never invitation credentials.

func (delivery *RegistrationGrantDelivery) UnmarshalJSON(data []byte) error
UnmarshalJSON validates required delivery scalars, lifecycle values and
bindings.

type RegistrationGrantDeliveryRequest struct {
Recipient string `json:"recipient"`
Locale string `json:"locale,omitempty"`
Variant string `json:"variant"`
}
RegistrationGrantDeliveryRequest queues an explicitly addressed LINK or CODE
email.

type RegistrationGrantListOptions struct {
Type *RegistrationGrantType
Status *RegistrationGrantStatus
Search *string
Page *int
Size *int
}
RegistrationGrantListOptions filters the grant list using the API's page
parameters.

type RegistrationGrantPage struct {
Content []RegistrationGrant `json:"content"`
Page RegistrationGrantPageMetadata `json:"page"`
}
RegistrationGrantPage is a page of safe registration grants.

type RegistrationGrantPageMetadata struct {
Size int `json:"size"`
Number int `json:"number"`
TotalElements int64 `json:"totalElements"`
TotalPages int `json:"totalPages"`
}
RegistrationGrantPageMetadata is the nested Spring PagedModel metadata.

type RegistrationGrantRedemption struct {
ID string `json:"id"`
Result string `json:"result"`
Email *string `json:"email"`
AuthMethod *string `json:"authMethod"`
IDPID *string `json:"idpId"`
ClientID *string `json:"clientId"`
RedeemedAt string `json:"redeemedAt"`
FailureReason *string `json:"failureReason"`
}
RegistrationGrantRedemption is a safe masked redemption-history entry.

type RegistrationGrantRedemptionPage struct {
Content []RegistrationGrantRedemption `json:"content"`
Page RegistrationGrantPageMetadata `json:"page"`
}
RegistrationGrantRedemptionPage is a page of safe masked redemption history.

type RegistrationGrantStatus string
RegistrationGrantStatus is a safe lifecycle status returned by iam-portal.

const (
RegistrationGrantActive RegistrationGrantStatus = "ACTIVE"
RegistrationGrantPaused RegistrationGrantStatus = "PAUSED"
RegistrationGrantRedeemed RegistrationGrantStatus = "REDEEMED"
RegistrationGrantExpired RegistrationGrantStatus = "EXPIRED"
RegistrationGrantRevoked RegistrationGrantStatus = "REVOKED"
)
Supported RegistrationGrantStatus wire values.

type RegistrationGrantType string
RegistrationGrantType is one safe registration-grant type returned by the
API.

const (
RegistrationGrantEmailLink RegistrationGrantType = "EMAIL_LINK"
RegistrationGrantAccessCode RegistrationGrantType = "ACCESS_CODE"
RegistrationGrantOrgInvitation RegistrationGrantType = "ORG_INVITATION"
)
Supported RegistrationGrantType wire values.

type RemoveIdentity struct {
IdentifierID string `json:"identifierId"`
ReplacementPrimaryID *string `json:"replacementPrimaryId,omitempty" wire:"optional"`
}
RemoveIdentity mirrors the current-user producer contract.

type ReplaceIdentity struct {
IdentifierID string `json:"identifierId"`
Replacement LoginIdentifier `json:"replacement"`
RemoveOld bool `json:"removeOld"`
ReplacementPrimaryID *string `json:"replacementPrimaryId,omitempty" wire:"optional"`
}
ReplaceIdentity mirrors the current-user producer contract.

type ResolveMode int
ResolveMode controls how the SDK loads role→permission mappings.

const (
// ResolveOnDemand resolves permissions on the first request for a role
// set and caches the result. This is the default.
ResolveOnDemand ResolveMode = iota
// ResolveFullSync pre-loads every role→permission mapping at startup.
ResolveFullSync
)
type ResolvePermissionsRequest struct {
ClientID string `json:"clientId"`
Roles []string `json:"roles"`
}
ResolvePermissionsRequest is the request body for
/open/v1/permissions:resolve.

type ResolvePermissionsResponse struct {
Permissions []string `json:"permissions"`
}
ResolvePermissionsResponse is the response body for
/open/v1/permissions:resolve.

type Role struct {
ID string `json:"id"`
Key string `json:"key"`
Name string `json:"name"`
Description *string `json:"description"`
System bool `json:"system"`
Version int64 `json:"version"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
ETag string `json:"-"`
}
Role is an Application-scoped role and its strong response ETag.

type RolePage struct {
Content []Role `json:"content"`
Page AuthorizationPageMetadata `json:"page"`
}
RolePage is a deterministic page of roles.

type RolePermissionBinding struct {
RoleID string `json:"roleId"`
PermissionID string `json:"permissionId"`
CreatedAt string `json:"createdAt"`
}
RolePermissionBinding describes one persisted role-permission mapping.

type RolePermissionBindingPage struct {
Content []RolePermissionBinding `json:"content"`
Page AuthorizationPageMetadata `json:"page"`
ETag string `json:"-"`
}
RolePermissionBindingPage is a page of mappings plus the role ETag.

type RolePermissionSet struct {
RoleID string `json:"roleId"`
PermissionIDs []string `json:"permissionIds"`
Version int64 `json:"version"`
ETag string `json:"-"`
}
RolePermissionSet is the replacement result and new role version/ETag.

type SDK struct {
// Has unexported fields.
}
SDK is the high-level composite used by applications. It bundles a *Client,
a JWT verifier, and a permission resolver.

Applications typically construct an SDK once at startup, install its
Authenticate middleware on the router and use RequirePerm on individual
routes.

func New(cfg *SDKConfig) (*SDK, error)
New constructs an SDK from cfg. It:

1. validates cfg
2. creates an IAM client
3. performs OIDC discovery to obtain jwks_uri
4. builds the JWT verifier and HTTP-backed permission resolver

func (s *SDK) AcceptOrganizationInvitation(ctx context.Context, invitationToken, accessToken string) (*PublicOrganizationInvitationAcceptResponse, error)
AcceptOrganizationInvitation accepts or continues a public Organization
invitation flow.

func (s *SDK) Authenticate(opts ...AuthOption) func(http.Handler) http.Handler
Authenticate returns a net/http middleware that validates the bearer JWT and
injects an authz.User into the request context.

func (s *SDK) AuthorizeIdentityOperation(ctx context.Context, accessToken string, operationID string, request IdentityProviderAuthorize) (*ProviderAuthorization, error)
AuthorizeIdentityOperation delegates to the explicit current-user client.

func (s *SDK) AuthorizeMFAOperation(ctx context.Context, accessToken string, operationID string, request MFAProviderAuthorize) (*ProviderAuthorization, error)
AuthorizeMFAOperation delegates to the explicit current-user client.

func (s *SDK) BeginTOTPEnrollmentOperation(ctx context.Context, accessToken string, operationID string) (*TOTPBeginResult, error)
BeginTOTPEnrollmentOperation delegates to the explicit current-user client.

func (s *SDK) CancelIdentityOperation(ctx context.Context, accessToken string, operationID string) (*IdentityOperation, error)
CancelIdentityOperation delegates to the explicit current-user client.

func (s *SDK) CancelMFAOperation(ctx context.Context, accessToken string, operationID string) (*MFAOperation, error)
CancelMFAOperation delegates to the explicit current-user client.

func (s *SDK) ChallengeIdentityCurrentAccount(ctx context.Context, accessToken string, operationID string, identifierID string) (*IdentityChallengeResult, error)
ChallengeIdentityCurrentAccount delegates to the explicit current-user
client.

func (s *SDK) ChallengeIdentityOperation(ctx context.Context, accessToken string, operationID string, targetProofMethod TargetProofMethod) (*IdentityOperation, error)
ChallengeIdentityOperation delegates to the explicit current-user client.

func (s *SDK) ChallengeMFAOperation(ctx context.Context, accessToken string, operationID string, identifierID string) (*MFAChallengeResult, error)
ChallengeMFAOperation delegates to the explicit current-user client.

func (s *SDK) ChangePassword(ctx context.Context, accessToken string, input PasswordChangeRequest) error
ChangePassword changes the current user's password with bearer auth.

func (s *SDK) CheckAccountPermission(ctx context.Context, accessToken, permission, organizationID string) (*PermissionCheckResponse, error)
CheckAccountPermission checks one permission through IAM.

func (s *SDK) Client() *Client
Client returns the low-level HTTP client.

func (s *SDK) CompleteIdentityOperation(ctx context.Context, accessToken string, operationID string, request IdentityOperationComplete) (*IdentityOperation, error)
CompleteIdentityOperation delegates to the explicit current-user client.

func (s *SDK) CompleteIdentityProviderAuthorization(ctx context.Context, accessToken string, operationID string, request ProviderExchange) (*IdentityOperation, error)
CompleteIdentityProviderAuthorization delegates to the explicit current-user
client.

func (s *SDK) CompleteMFAOperation(ctx context.Context, accessToken string, operationID string, code *string) (*MFACompletionResult, error)
CompleteMFAOperation delegates to the explicit current-user client.

func (s *SDK) CompleteMFAProviderAuthorization(ctx context.Context, accessToken string, operationID string, request ProviderExchange) (*MFAOperation, error)
CompleteMFAProviderAuthorization delegates to the explicit current-user
client.

func (s *SDK) ConfirmIdentityTransfer(ctx context.Context, accessToken string, operationID string, decision TransferDecision) (*IdentityOperation, error)
ConfirmIdentityTransfer delegates to the explicit current-user client.

func (s *SDK) CreateIdentityOperation(ctx context.Context, accessToken string, request IdentityOperationCreate, idempotencyKey string) (*IdentityOperation, error)
CreateIdentityOperation delegates to the explicit current-user client.

func (s *SDK) CreateMFAOperation(ctx context.Context, accessToken string, request MFAOperationCreate, idempotencyKey string) (*MFAOperation, error)
CreateMFAOperation delegates to the explicit current-user client.

func (s *SDK) GetAccountPermissionSummary(ctx context.Context, accessToken, organizationID string) (*AccountPermissionSummary, error)
GetAccountPermissionSummary resolves current-user permissions in IAM.

func (s *SDK) GetAccountSecuritySummary(ctx context.Context, accessToken string) (*AccountSecuritySummary, error)
GetAccountSecuritySummary returns a secret-free current-user security
summary.

func (s *SDK) GetCurrentAccountOrganization(ctx context.Context, accessToken string) (*AccountOrganization, error)
GetCurrentAccountOrganization returns the selected Organization context,
if any.

func (s *SDK) GetIdentityOperation(ctx context.Context, accessToken string, operationID string) (*IdentityOperation, error)
GetIdentityOperation delegates to the explicit current-user client.

func (s *SDK) GetMFACapabilities(ctx context.Context, accessToken string) (*MFACapabilities, error)
GetMFACapabilities delegates to the explicit current-user client.

func (s *SDK) GetMFAOperation(ctx context.Context, accessToken string, operationID string) (*MFAOperation, error)
GetMFAOperation delegates to the explicit current-user client.

func (s *SDK) GetMe(ctx context.Context, accessToken string, opts ...UserProfileOption) (*UserProfile, error)
GetMe returns the current user's latest profile from GET /api/v1/auth/me.
It uses a short local cache keyed by request user id when available, or by
a SHA-256 digest of the bearer token otherwise. Authorization checks should
use FromContext and resolved permissions instead of this profile response.
Profile metadata is not App User authorization attributes.

func (s *SDK) GetRecoveryCodesRemaining(ctx context.Context, accessToken string) (*RecoveryCodesRemaining, error)
GetRecoveryCodesRemaining reads the current user's unused recovery-code
count through the shared Client.

func (s *SDK) HasAccountOrganizationMembership(ctx context.Context, accessToken, organizationID string) (bool, error)
HasAccountOrganizationMembership derives membership from the Organization
list.

func (s *SDK) ListAccountIdentifiers(ctx context.Context, accessToken string) (*AccountIdentifiers, error)
ListAccountIdentifiers delegates to the explicit current-user client.

func (s *SDK) ListAccountLoginMethods(ctx context.Context, accessToken string) (*AccountLoginMethods, error)
ListAccountLoginMethods delegates to the explicit current-user client.

func (s *SDK) ListAccountOrganizations(ctx context.Context, accessToken string) ([]AccountOrganization, error)
ListAccountOrganizations lists the current user's Application-scoped
Organizations.

func (s *SDK) ListAccountSessions(ctx context.Context, accessToken string) ([]SessionView, error)
ListAccountSessions lists the current user's active sessions.

func (s *SDK) ListIdentityTransfers(ctx context.Context, accessToken string) ([]IdentityOperation, error)
ListIdentityTransfers delegates to the explicit current-user client.

func (s *SDK) ListLinkableIdentityProviders(ctx context.Context, accessToken string) ([]LinkableIdentityProvider, error)
ListLinkableIdentityProviders delegates to the explicit current-user client.

func (s *SDK) LogoutAccount(ctx context.Context, accessToken string) error
LogoutAccount logs out the current token/session and revokes its OAuth
session.

func (s *SDK) PreviewOrganizationInvitation(ctx context.Context, invitationToken string) (*PublicOrganizationInvitationPreview, error)
PreviewOrganizationInvitation returns safe public invitation metadata
without bearer auth.

func (s *SDK) ReauthenticateIdentityOperation(ctx context.Context, accessToken string, operationID string, request Reauthentication) (*IdentityOperation, error)
ReauthenticateIdentityOperation delegates to the explicit current-user
client.

func (s *SDK) ReauthenticateMFAOperation(ctx context.Context, accessToken string, operationID string, request Reauthentication) (*MFAOperation, error)
ReauthenticateMFAOperation delegates to the explicit current-user client.

func (s *SDK) RequestPasswordReset(ctx context.Context, email, redirectURI string) error
RequestPasswordReset starts the opaque public forgot-password flow.

func (s *SDK) RequireAllPerms(perms []authz.PermissionKey, opts ...middleware.Option) func(http.Handler) http.Handler
RequireAllPerms is shorthand for middleware.RequireAllPerms using this SDK.

func (s *SDK) RequireAnyPerm(perms []authz.PermissionKey, opts ...middleware.Option) func(http.Handler) http.Handler
RequireAnyPerm is shorthand for middleware.RequireAnyPerm using this SDK.

func (s *SDK) RequireNoImpersonation(opts ...middleware.Option) func(http.Handler) http.Handler
RequireNoImpersonation is shorthand for middleware.RequireNoImpersonation
using this SDK.

func (s *SDK) RequirePerm(perm authz.PermissionKey, opts ...middleware.Option) func(http.Handler) http.Handler
RequirePerm is shorthand for middleware.RequirePerm using this SDK.

func (s *SDK) RequireStepUp(acr string, opts ...middleware.Option) func(http.Handler) http.Handler
RequireStepUp is shorthand for middleware.RequireStepUp using this SDK.

func (s *SDK) ResetPassword(ctx context.Context, token, newPassword string) error
ResetPassword completes the public password reset flow.

func (s *SDK) Resolver() authz.Resolver
Resolver returns the permission resolver.

func (s *SDK) RevokeAccountSession(ctx context.Context, accessToken, sessionID string) error
RevokeAccountSession revokes one session owned by the current user.

func (s *SDK) RevokeOtherAccountSessions(ctx context.Context, accessToken string) error
RevokeOtherAccountSessions revokes all sessions except the current token's
sid.

func (s *SDK) SendEmailVerification(ctx context.Context, email string) (*EmailVerificationResponse, error)
SendEmailVerification starts the opaque public email verification send flow.

func (s *SDK) StartIdentityOperationStepUp(ctx context.Context, accessToken string, operationID string) (*OperationStepUpChallenge, error)
StartIdentityOperationStepUp delegates to the explicit current-user client.

func (s *SDK) StartIdentityOperationWebAuthn(ctx context.Context, accessToken string, operationID string, challengeID string) (*OperationWebAuthnStart, error)
StartIdentityOperationWebAuthn delegates to the explicit current-user
client.

func (s *SDK) StartMFAOperationStepUp(ctx context.Context, accessToken string, operationID string) (*OperationStepUpChallenge, error)
StartMFAOperationStepUp delegates to the explicit current-user client.

func (s *SDK) StartMFAOperationWebAuthn(ctx context.Context, accessToken string, operationID string, challengeID string) (*OperationWebAuthnStart, error)
StartMFAOperationWebAuthn delegates to the explicit current-user client.

func (s *SDK) SwitchAccountOrganization(ctx context.Context, accessToken, organizationID string) (*OrganizationSwitchResponse, error)
SwitchAccountOrganization validates membership and returns a refresh/reauth
continuation.

func (s *SDK) UpdateAccountProfile(ctx context.Context, accessToken string, input AccountUpdateProfileRequest) (*UserProfile, error)
UpdateAccountProfile updates safe scalar profile fields for the current
user.

func (s *SDK) Verifier() *iamjwt.Verifier
Verifier returns the JWT verifier.

func (s *SDK) VerifyEmail(ctx context.Context, token string) (*EmailVerificationResponse, error)
VerifyEmail verifies a public email-verification token.

func (s *SDK) VerifyIdentityOperationStepUp(ctx context.Context, accessToken string, operationID string, request OperationStepUpVerify) (*IdentityOperation, error)
VerifyIdentityOperationStepUp delegates to the explicit current-user client.

func (s *SDK) VerifyIdentityOperationWebAuthn(ctx context.Context, accessToken string, operationID string, request OperationWebAuthnVerify) (*IdentityOperation, error)
VerifyIdentityOperationWebAuthn delegates to the explicit current-user
client.

func (s *SDK) VerifyMFAOperationStepUp(ctx context.Context, accessToken string, operationID string, request OperationStepUpVerify) (*MFAOperation, error)
VerifyMFAOperationStepUp delegates to the explicit current-user client.

func (s *SDK) VerifyMFAOperationWebAuthn(ctx context.Context, accessToken string, operationID string, request OperationWebAuthnVerify) (*MFAOperation, error)
VerifyMFAOperationWebAuthn delegates to the explicit current-user client.

type SDKConfig struct {
// Endpoint is the base URL of the IAM server, e.g. https://iam.example.com.
Endpoint string
// ClientID is ApplicationClient.clientId for the WEB/M2M confidential client
// used by this server-side SDK.
ClientID string
// ClientSecret authenticates the WEB/M2M confidential ApplicationClient.
ClientSecret string
// Audience is Application.resourceAudience, the expected JWT aud claim.
// Required by New; never inferred from ClientID. Optional for HTTP-only NewClient.
Audience string
// Issuer expected in JWTs. Defaults to Endpoint.
Issuer string

// JWKSRefresh is the interval at which the JWKS is refreshed. Default 1h.
JWKSRefresh time.Duration
// PermissionCacheTTL is the TTL of the role→permissions cache. Default 5m.
PermissionCacheTTL time.Duration
// PermissionCacheMax is the maximum number of cache entries. Default 10000.
PermissionCacheMax int64
// UserProfileCacheTTL is the TTL for explicit /api/v1/auth/me/profile lookups. Default 1m.
UserProfileCacheTTL time.Duration
// UserProfileCacheMax is the maximum number of user profile cache entries. Default 10000.
UserProfileCacheMax int64
// DisableUserProfileCache disables caching for SDK.GetMe. Client.GetMe is always uncached.
DisableUserProfileCache bool

ResolveMode ResolveMode
FailMode FailMode

HTTPTimeout time.Duration // default 5s
MaxRetries int // default 3
}
SDKConfig is the runtime configuration accepted by New.

func (c *SDKConfig) Validate() error
Validate normalises defaults and returns an error for missing required
fields.

type SensitiveDelivery string
SensitiveDelivery is an operation wire enum; unsupported response values
fail closed.

const (
SensitiveDeliveryAvailable SensitiveDelivery = "AVAILABLE"
SensitiveDeliveryAlreadyDelivered SensitiveDelivery = "ALREADY_DELIVERED"
SensitiveDeliveryNotApplicable SensitiveDelivery = "NOT_APPLICABLE"
)
Supported SensitiveDelivery wire values.

type SessionImpact string
SessionImpact is an operation wire enum; unsupported response values fail
closed.

const (
SessionImpactUnchanged SessionImpact = "UNCHANGED"
SessionImpactCurrentSessionRetained SessionImpact = "CURRENT_SESSION_RETAINED"
SessionImpactReauthenticate SessionImpact = "REAUTHENTICATE"
)
Supported SessionImpact wire values.

type SessionView struct {
SessionID string `json:"sessionId"`
IPAddress string `json:"ipAddress,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
DeviceID string `json:"deviceId,omitempty"`
CreatedAt string `json:"createdAt"`
LastSeenAt string `json:"lastSeenAt"`
Current bool `json:"current"`
}
SessionView is the current user's session/device view.

type SetPrimaryIdentity struct {
IdentifierID string `json:"identifierId"`
}
SetPrimaryIdentity mirrors the current-user producer contract.

type TOTPBeginResult struct {
Operation MFAOperation `json:"operation"`
Delivery SensitiveDelivery `json:"delivery"`
Material *TOTPMaterial `json:"material,omitempty" wire:"optional"`
}
TOTPBeginResult mirrors the current-user producer contract.

func (TOTPBeginResult) GoString() string
GoString returns a redacted Go-syntax representation.

func (TOTPBeginResult) String() string

type TOTPMaterial struct {
Secret string `json:"secret"`
QRCodeURI string `json:"qrCodeUri"`
Issuer string `json:"issuer"`
}
TOTPMaterial mirrors the current-user producer contract.

func (TOTPMaterial) GoString() string
GoString returns a redacted Go-syntax representation.

func (TOTPMaterial) String() string

type TargetProofMethod string
TargetProofMethod is an operation wire enum; unsupported response values
fail closed.

const (
TargetProofMethodEmailOTP TargetProofMethod = "EMAIL_OTP"
TargetProofMethodPhoneOTP TargetProofMethod = "PHONE_OTP"
)
Supported TargetProofMethod wire values.

type TransferDecision string
TransferDecision is an operation wire enum; unsupported response values fail
closed.

const (
TransferDecisionAccept TransferDecision = "ACCEPT"
TransferDecisionReject TransferDecision = "REJECT"
)
Supported TransferDecision wire values.

type TransferIdentity struct {
IdentifierID string `json:"identifierId"`
TargetUserID string `json:"targetUserId"`
SourceReplacementPrimaryID *string `json:"sourceReplacementPrimaryId,omitempty" wire:"optional"`
}
TransferIdentity mirrors the current-user producer contract.

type UnlinkIdentity struct {
MethodID string `json:"methodId"`
}
UnlinkIdentity mirrors the current-user producer contract.

type UpdateOrganizationRequest struct {
Name *string `json:"name,omitempty"`
Slug *string `json:"slug,omitempty"`
}
UpdateOrganizationRequest is the strict PATCH payload. Nil fields are
omitted.

type UpdatePermissionRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
}
UpdatePermissionRequest is the strict permission PATCH payload.

type UpdateRoleRequest struct {
Key *string `json:"key,omitempty"`
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
}
UpdateRoleRequest is the strict role PATCH payload.

type UpdateUserRoleRequest struct {
Condition *UserRoleCondition `json:"condition"`
}
UpdateUserRoleRequest replaces an assignment condition.

type UserProfile struct {
UserID string `json:"userId"`
ApplicationID string `json:"applicationId"`
GlobalIdentityID *string `json:"globalIdentityId"`
Email *string `json:"email"`
EmailVerified bool `json:"emailVerified"`
Username *string `json:"username"`
DisplayName *string `json:"displayName"`
AvatarURL *string `json:"avatarUrl"`
Status string `json:"status"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CurrentOrganization *AccountOrganization `json:"currentOrganization"`
}
UserProfile is the response returned by GET /api/v1/auth/me/profile.
Nullable profile projections remain nil. Authorization roles and permissions
are returned separately by GetAccountPermissionSummary.

type UserProfileOption func(*userProfileOptions)
UserProfileOption configures SDK.GetMe profile lookup behavior.

func BypassProfileCache() UserProfileOption
BypassProfileCache forces SDK.GetMe to call IAM even if a cached profile
exists. The fresh result replaces the cached entry.

type UserRoleAssignment struct {
ID string `json:"id"`
UserID string `json:"userId"`
RoleID string `json:"roleId"`
OrganizationID *string `json:"organizationId"`
ConditionExpression *string `json:"conditionExpression"`
ConditionDescription *string `json:"conditionDescription"`
Version int64 `json:"version"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
ETag string `json:"-"`
}
UserRoleAssignment is an Application-scoped assignment with optimistic-lock
state.

type UserRoleAssignmentPage struct {
Content []UserRoleAssignment `json:"content"`
Page AuthorizationPageMetadata `json:"page"`
}
UserRoleAssignmentPage is a deterministic page of assignments.

type UserRoleCondition struct {
Expression *string `json:"expression"`
Description *string `json:"description"`
}
UserRoleCondition carries the optional assignment expression and
description.

type VerifyIdentity struct {
IdentifierID string `json:"identifierId"`
}
VerifyIdentity mirrors the current-user producer contract.


github.com/axis-iam/vertex-sdk-go/authz​

package authz // import "github.com/axis-iam/vertex-sdk-go/authz"

Package authz contains the permission model primitives used by the SDK:
PermissionKey, PermissionDefinition, the Resolver interface that maps roles →
permissions, and the context-aware HasPermission helper.

VARIABLES

var (
ErrUnauthenticated = errors.New("authz: unauthenticated")
ErrForbidden = errors.New("authz: forbidden")
)
Errors returned from the context helpers.


FUNCTIONS

func HasAllPermissions(targets []PermissionKey, granted []string) bool
HasAllPermissions reports whether every target is satisfied by granted.

func HasAnyPermission(targets []PermissionKey, granted []string) bool
HasAnyPermission reports whether at least one target is satisfied by
granted.

func HasPermission(target PermissionKey, granted []string) bool
HasPermission reports whether any of the granted permission strings
satisfies target.

func Matches(target PermissionKey, granted string) bool
Matches reports whether a granted permission string satisfies the target.
Matching rules (aligned with sdk-js / sdk-java):

- exact match: "orders:read" matches "orders:read"
- action wildcard: "orders:*" matches "orders:read" and "orders:create"
- full wildcard: "*:*" matches everything
- resource-agnostic action wildcard "*:read" is rejected
- malformed or non-canonical entries never match
- matching is case sensitive

func MustPermission(ctx context.Context, perm PermissionKey) error
MustPermission returns an error if the current context does not satisfy
perm.

func WithUser(ctx context.Context, u *User) context.Context
WithUser returns a new context carrying u.


TYPES

type Actor struct {
Subject string
}
Actor is the delegating subject for impersonation (JWT act claim).

type HttpResolver struct {
// Has unexported fields.
}
HttpResolver resolves role → permission mappings via the IAM /open/v1 API
with a local ristretto cache and singleflight deduplication.

func NewHttpResolver(client ResolveClient, opts HttpResolverOptions) (*HttpResolver, error)
NewHttpResolver wires up a resolver backed by ristretto.

func (r *HttpResolver) Clear()
Clear evicts every cached entry.

func (r *HttpResolver) Invalidate(clientID string, roles []string)
Invalidate drops the cached mapping for a (clientID, roles) pair.

func (r *HttpResolver) Resolve(ctx context.Context, clientID string, roles []string) ([]string, error)
Resolve implements Resolver.

type HttpResolverOptions struct {
TTL time.Duration
MaxEntries int64
FailOpen bool
}
HttpResolverOptions configures an HttpResolver.

type InvalidPermissionError struct{ Raw string }
InvalidPermissionError is returned when a permission string is malformed.

func (e *InvalidPermissionError) Error() string

type PermissionDefinition struct {
Resource string
Action string
Description string
}
PermissionDefinition is a permission declaration — the registered form
uploaded to the IAM server and referenced by codegen.

func (d PermissionDefinition) Key() PermissionKey
Key returns the PermissionKey corresponding to this definition.

type PermissionKey struct {
Resource string
Action string
}
PermissionKey is the canonical identifier for a permission — a pair of
resource and action strings.

func ParsePermission(s string) (PermissionKey, error)
ParsePermission parses a "resource:action" string. Empty components and
missing colons yield an error.

func (k PermissionKey) Authority() string
Authority returns the "resource:action" string form used on the wire.

func (k PermissionKey) IsConcrete() bool
IsConcrete reports whether the key is a canonical non-wildcard declaration
key.

func (k PermissionKey) IsZero() bool
IsZero reports whether the key is empty.

func (k PermissionKey) String() string
String implements fmt.Stringer and returns the same as Authority.

type ResolveClient interface {
ResolvePermissions(ctx context.Context, clientID string, roles []string) (*ResolvePermissionsResponse, error)
}
ResolveClient is the minimum surface HttpResolver needs from the IAM client.
It is satisfied by *iam.Client.

type ResolvePermissionsResponse struct {
Permissions []string `json:"permissions"`
}
ResolvePermissionsResponse must match the shape returned by the IAM server.
It is redeclared here (rather than imported from the top-level iam package)
to avoid an import cycle.

type Resolver interface {
Resolve(ctx context.Context, clientID string, roles []string) ([]string, error)
}
Resolver maps a (clientID, roles) tuple to the flat list of permissions the
user holds. Implementations may cache, fall back or fail open.

type ResolverFunc func(ctx context.Context, clientID string, roles []string) ([]string, error)
ResolverFunc adapts a plain function into a Resolver.

func (f ResolverFunc) Resolve(ctx context.Context, clientID string, roles []string) ([]string, error)
Resolve implements Resolver.

type User struct {
Subject string
AppID string
Email string
OrgID string
OrgRole string
WorkspaceID string
SessionID string
Roles []string
Permissions []string
AMR []string
ACR string
Actor *Actor
Claims map[string]any
}
User is the authenticated caller as seen by the request-scoped context.

func FromContext(ctx context.Context) *User
FromContext returns the User previously stored with WithUser, or nil.

func (u *User) HasMFA() bool
HasMFA reports whether the JWT's amr claim includes an MFA factor.

func (u *User) HasPermission(resource, action string) bool
HasPermission mirrors the package-level HasPermission against this user's
permission list.

func (u *User) IsImpersonating() bool
IsImpersonating reports whether the current request is an admin acting as
another user.


github.com/axis-iam/vertex-sdk-go/cmd/iam-codegen​

iam-codegen generates constants locally and validates/upserts structured
manifests explicitly.

iam-codegen generate — generate Go constants from a local structured manifest
iam-codegen upload — validate/upsert a structured manifest from a server-only job

See `iam-codegen help` for flag details.

github.com/axis-iam/vertex-sdk-go/cmd/iam-codegen/generator​

package generator // import "github.com/axis-iam/vertex-sdk-go/cmd/iam-codegen/generator"

Package generator renders Go source files for declared IAM permission
definitions and parses existing permission.go sources.

FUNCTIONS

func ConstName(resource, action string) string
ConstName turns a resource+action pair into a valid Go identifier.
"signing-keys" + "read" becomes "SigningKeysRead". Callers must pass
concrete manifest keys; Render rejects wildcard declarations before naming.

func Render(in Input) ([]byte, error)
Render produces the Go source for permissions.gen.go.


TYPES

type Input struct {
Package string
GoImport string // defaults to "github.com/axis-iam/vertex-sdk-go/authz"
Permissions []authz.PermissionDefinition
}
Input drives the template.


github.com/axis-iam/vertex-sdk-go/examples/shared-permissions​

package sharedpermissions // import "github.com/axis-iam/vertex-sdk-go/examples/shared-permissions"

Code generated by iam-codegen from iam-permission-manifest.json. DO NOT EDIT.

VARIABLES

var All = []authz.PermissionDefinition{
{Resource: "orders", Action: "read", Description: "Read orders"},
}
var OrdersRead = authz.PermissionKey{Resource: "orders", Action: "read"}

github.com/axis-iam/vertex-sdk-go/iamtest​

package iamtest // import "github.com/axis-iam/vertex-sdk-go/iamtest"

Package iamtest provides testing helpers for applications built on the IAM SDK:
an httptest-backed mock IAM server, a MockResolver, and a context helper to
inject roles/permissions into unit tests.

FUNCTIONS

func NewContext(ctx context.Context, opts ...Option) context.Context
NewContext returns a context carrying an authz.User built from opts.


TYPES

type AccountOrganizationDTO struct {
OrganizationID string `json:"organizationId"`
Name string `json:"name"`
Slug string `json:"slug,omitempty"`
Role string `json:"role"`
JoinedAt string `json:"joinedAt,omitempty"`
Current bool `json:"current"`
}
AccountOrganizationDTO mirrors current-user organization membership
responses.

type MockResolver struct {
// Has unexported fields.
}
MockResolver is a deterministic authz.Resolver for unit tests.

func NewMockResolver() *MockResolver
NewMockResolver returns a fresh MockResolver with no mappings.

func (m *MockResolver) Given(role string, perms ...string) *MockResolver
Given maps role → perms. Chainable.

func (m *MockResolver) Resolve(_ context.Context, _ string, roles []string) ([]string, error)
Resolve implements authz.Resolver. Returns the union of permissions for the
requested roles, deduplicated + sorted for reproducibility.

type MockServer struct {
*httptest.Server

// Has unexported fields.
}
MockServer is an httptest.Server that exposes the subset of IAM endpoints
the SDK needs: OIDC discovery, JWKS, resolve, and permission snapshots.

func NewMockServer() (*MockServer, error)
NewMockServer spins up a server with resource audience api://orders.
Call s.Close() when done; WithAudience overrides the token audience.

func (m *MockServer) Given(role string, perms ...string) *MockServer
Given maps a role → perms for the resolve endpoint.

func (m *MockServer) GivenUserProfile(subject string, profile UserProfileDTO) *MockServer
GivenUserProfile configures the response returned by /api/v1/auth/me/profile
for a subject.

func (m *MockServer) Issuer() string
Issuer returns the URL of the server (used as the JWT issuer).

func (m *MockServer) MeCalls() int
MeCalls returns how many times /api/v1/auth/me was invoked.

func (m *MockServer) TokenCalls(scope string) int
TokenCalls returns how many /oauth2/token requests used the given scope.

func (m *MockServer) TokenFor(subject string, roles []string) (string, error)
TokenFor signs a JWT for the given subject + roles, with default validity of
5 minutes.

func (m *MockServer) TokenForWith(subject string, roles []string, extra map[string]any) (string, error)
TokenForWith signs a JWT with extra claims merged in (typically app_id,
org_id, acr, etc.).

func (m *MockServer) WithAudience(aud string) *MockServer
WithAudience sets the aud claim stamped by TokenFor.

type Option func(*authz.User)
Option mutates a test *authz.User.

func WithACR(acr string) Option
WithACR sets the ACR.

func WithAppID(id string) Option
WithAppID sets the app_id claim.

func WithEmail(email string) Option
WithEmail sets the email.

func WithImpersonator(actor string) Option
WithImpersonator marks the user as impersonated by actor.

func WithOrg(orgID, orgRole string) Option
WithOrg sets the org context.

func WithPermissions(perms ...string) Option
WithPermissions sets the permissions.

func WithRoles(roles ...string) Option
WithRoles sets the roles.

func WithSubject(sub string) Option
WithSubject sets the user subject.

type PermissionDefinitionDTO struct {
Resource string `json:"resource"`
Action string `json:"action"`
Description string `json:"description,omitempty"`
}
PermissionDefinitionDTO mirrors the SDK's wire format (duplicated to avoid a
dependency on the top-level iam package).

type UserProfileDTO struct {
UserID string `json:"userId"`
ApplicationID string `json:"applicationId"`
GlobalIdentityID *string `json:"globalIdentityId"`
Email *string `json:"email"`
EmailVerified bool `json:"emailVerified"`
Username *string `json:"username"`
DisplayName *string `json:"displayName"`
AvatarURL *string `json:"avatarUrl"`
Status string `json:"status"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CurrentOrganization *AccountOrganizationDTO `json:"currentOrganization"`
}
UserProfileDTO mirrors GET /api/v1/auth/me/profile, including nullable
projections.


github.com/axis-iam/vertex-sdk-go/jwt​

package iamjwt // import "github.com/axis-iam/vertex-sdk-go/jwt"

Package iamjwt provides JWT verification against an IAM JWKS endpoint.
Package name differs from the directory (iamjwt vs. jwt) to avoid collision with
github.com/go-jose/go-jose/v4/jwt.

VARIABLES

var (
ErrInvalidToken = errors.New("iamjwt: invalid token")
ErrUnknownKey = errors.New("iamjwt: unknown signing key")
ErrJWKSFetch = errors.New("iamjwt: JWKS fetch failed")
ErrJWKSParse = errors.New("iamjwt: JWKS parse failed")
)
Verification error categories can be inspected with errors.Is.


TYPES

type Actor struct {
Subject string `json:"sub"`
}
Actor is the JWT act claim for delegated/impersonated sessions.

type Claims struct {
jwt.Claims
AppID string `json:"app_id,omitempty"`
Email string `json:"email,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"`
OrgID string `json:"org_id,omitempty"`
OrgSlug string `json:"org_slug,omitempty"`
OrgRole string `json:"org_role,omitempty"`
Roles []string `json:"roles,omitempty"`
AMR []string `json:"amr,omitempty"`
ACR string `json:"acr,omitempty"`
SessionID string `json:"sid,omitempty"`
Actor *Actor `json:"act,omitempty"`
Extra map[string]any `json:"-"`
}
Claims is the union of IAM-specific JWT fields overlaid on the standard
registered claims (iss, aud, sub, exp, ...).

type JWKSOptions struct {
URL string
Client *http.Client
Refresh time.Duration
RotationCooldown time.Duration
}
JWKSOptions configures a JWKSProvider.

type JWKSProvider struct {
// Has unexported fields.
}
JWKSProvider fetches the IAM server's JSON Web Key Set and caches it with
lazy, coalesced refresh. It is safe for concurrent use.

func NewJWKSProvider(opts JWKSOptions) (*JWKSProvider, error)
NewJWKSProvider constructs a provider. The first fetch is lazy; call
Preload(ctx) to prime the cache eagerly.

func (p *JWKSProvider) KeyByID(ctx context.Context, kid string) (*jose.JSONWebKey, error)
KeyByID returns the key matching kid. If the key is absent, the provider
force-refreshes once (subject to a cooldown) to pick up rotated keys.

func (p *JWKSProvider) Preload(ctx context.Context) error
Preload fetches and caches the JWKS synchronously.

type JWKSStatusError struct {
StatusCode int
}
JWKSStatusError preserves a non-success HTTP status without exposing a body.

func (e *JWKSStatusError) Error() string

type VerificationError struct {
Kind error
Cause error
}
VerificationError classifies a verification failure without discarding its
underlying cause. Error messages are for internal diagnostics, not HTTP
bodies.

func (e *VerificationError) Error() string

func (e *VerificationError) Is(target error) bool
Is matches the stable verification category.

func (e *VerificationError) Unwrap() error

type Verifier struct {
// Has unexported fields.
}
Verifier validates IAM-issued JWTs.

func NewVerifier(opts VerifierOptions) (*Verifier, error)
NewVerifier constructs a Verifier. JWKS, Issuer, and Audience are required.

func (v *Verifier) Verify(ctx context.Context, token string) (*Claims, error)
Verify parses and validates a JWT, returning the union claims struct.

type VerifierOptions struct {
JWKS *JWKSProvider
Issuer string
Audience string // Application.resourceAudience; required, never inferred from client ID.
SignatureAlgs []jose.SignatureAlgorithm
ClockSkewLeeway time.Duration
}
VerifierOptions configures a Verifier.


github.com/axis-iam/vertex-sdk-go/middleware​

package middleware // import "github.com/axis-iam/vertex-sdk-go/middleware"

Package middleware provides framework-agnostic net/http middleware that wires
the IAM SDK into any Go router. Framework-specific adapters (chi, gin, echo)
live in their own submodules and delegate here where possible.

FUNCTIONS

func Auth(cfg AuthConfig) func(http.Handler) http.Handler
Auth builds a middleware that validates the bearer JWT, resolves
permissions, and injects an *authz.User into the request context.

func BearerToken(r *http.Request) string
BearerToken extracts the bearer token from the Authorization header,
or returns the empty string.

func DefaultErrorResponder(w http.ResponseWriter, _ *http.Request, status int, code, message string)
DefaultErrorResponder emits a small JSON payload.

func RequireAllPerms(perms []authz.PermissionKey, opts ...Option) func(http.Handler) http.Handler
RequireAllPerms passes only if the caller holds every perm.

func RequireAnyPerm(perms []authz.PermissionKey, opts ...Option) func(http.Handler) http.Handler
RequireAnyPerm passes if the caller holds any one of perms.

func RequireNoImpersonation(opts ...Option) func(http.Handler) http.Handler
RequireNoImpersonation rejects requests executed under an admin
impersonation token.

func RequirePerm(perm authz.PermissionKey, opts ...Option) func(http.Handler) http.Handler
RequirePerm returns a middleware that rejects the request with 403 if the
context User does not satisfy perm.

func RequireStepUp(acr string, opts ...Option) func(http.Handler) http.Handler
RequireStepUp enforces that the JWT's acr claim matches acr.


TYPES

type AuthConfig struct {
Verifier *iamjwt.Verifier
Resolver authz.Resolver
ClientID string
Responder ErrorResponder
}
AuthConfig is the configuration for Auth.

type ErrorResponder func(w http.ResponseWriter, r *http.Request, status int, code, message string)
ErrorResponder renders an error to the client. Applications can replace the
default JSON responder to match their API conventions.

type Option func(*options)
Option tunes a middleware helper.

func WithResponder(r ErrorResponder) Option
WithResponder lets callers substitute their own ErrorResponder.


github.com/axis-iam/vertex-sdk-go/websession​

package websession // import "github.com/axis-iam/vertex-sdk-go/websession"

Package websession provides the optional server_session authentication mode.
OAuth credentials and transaction control remain on the application backend.

CONSTANTS

const (
SchemaVersion = 1
Prelogin = "PRELOGIN"
SignedIn = "SIGNED_IN"
Owned = "OWNED"
SendIntent = "SEND_INTENT"
Invalidated = "INVALIDATED"
)

VARIABLES

var (
ErrInvalidSession = errors.New("websession: invalid session")
ErrUnavailable = errors.New("websession: dependency unavailable")
ErrForbidden = errors.New("websession: forbidden")
ErrRateLimited = errors.New("websession: rate limited")
ErrExchangeUncertain = errors.New("websession: exchange uncertain")
ErrRefreshUncertain = errors.New("websession: refresh uncertain")
ErrAbsent = errors.New("websession: record absent or expired")
ErrConflict = errors.New("websession: conditional operation conflict")
ErrCapacity = errors.New("websession: provider capacity")
ErrClosed = errors.New("websession: provider closed")
ErrValidation = errors.New("websession: invalid input")
)

TYPES

type AuthenticateInput struct {
Method string `json:"method"`
Identifier Identifier `json:"identifier"`
Password string `json:"password,omitempty"`
Proof string `json:"proof,omitempty"`
}

type Binding interface {
Read(ctx context.Context, r *http.Request) (string, error)
Write(ctx context.Context, w http.ResponseWriter, r *http.Request, id string, expires time.Time) error
Clear(ctx context.Context, w http.ResponseWriter, r *http.Request) error
}
Binding is the single owner of the browser's host-session identity. Native
session bridges store the SDK handle in a dedicated server-side namespace
and must rotate/fence it atomically; they must never auto-save token
snapshots. Read must distinguish absent ("",nil) from an unavailable host
store. Write and Clear preserve unrelated host session fields. A bridge must
not be combined with a second session Cookie owner. Clear must clear browser
authentication Cookie state even when returning a server-side storage error;
failure to change that namespace is reported as local UNCONFIRMED. It must
not rely on a successful storage write to clear it.

type Capabilities struct {
Atomic bool
Shared bool
}
Capabilities describe operations whose semantics must be proved by a
provider. Shared must only be true for an actually coordinated multi-process
backend.

type ChallengeInput struct {
Method string `json:"method"`
Identifier Identifier `json:"identifier"`
}

type Config struct {
Issuer, Audience, ClientID, ClientSecret string
Origin, CallbackURL, BasePath string
Scopes []string
ReturnTo string
AllowedReturnTo []string
PasswordResetURL string
Provider Provider
Binding Binding
// AllowLoopbackHTTP is development-only and requires loopback endpoints.
AllowLoopbackHTTP bool
Replicas, Workers int
HTTPClient *http.Client
PreloginTTL, AbsoluteTTL, IdleTTL time.Duration
RefreshLease, RefreshSkew time.Duration
UpstreamTimeout, AuthBudget time.Duration
Clock func() time.Time
}
Config enables server_session explicitly. None of these settings change the
existing JWT/Bearer SDK. Origin and redirects are never inferred from Host
or forwarded headers. TLS termination must enforce this configured public
origin.

type CookieBinding struct {
// Has unexported fields.
}

func NewCookieBinding(opts CookieOptions) (*CookieBinding, error)

func (b *CookieBinding) Clear(ctx context.Context, w http.ResponseWriter, r *http.Request) error

func (b *CookieBinding) Read(ctx context.Context, r *http.Request) (string, error)

func (b *CookieBinding) Write(ctx context.Context, w http.ResponseWriter, r *http.Request, id string, expires time.Time) error

type CookieOptions struct {
Origin string
Name string
AllowLoopbackHTTP bool
}

type Error struct {
Code string
Status int
RetryAfter int
Cause error
}
Error preserves a safe machine code and cause without rendering upstream
diagnostics, request URLs, credentials or token bytes.

func (e *Error) Error() string

func (e *Error) Unwrap() error

type HostBinding struct {
// Has unexported fields.
}

func NewHostBinding(host HostSession) (*HostBinding, error)

func (b *HostBinding) Clear(ctx context.Context, w http.ResponseWriter, r *http.Request) error

func (b *HostBinding) Read(ctx context.Context, r *http.Request) (string, error)

func (b *HostBinding) Write(ctx context.Context, w http.ResponseWriter, r *http.Request, id string, expires time.Time) error

type HostSession interface {
AtomicAuthentication() bool
ReadAuthentication(ctx context.Context, r *http.Request) (HostSnapshot, error)
ReplaceAuthentication(ctx context.Context, w http.ResponseWriter, r *http.Request, expected HostSnapshot, handle string, expires time.Time) error
// ClearAuthenticationCookie is an unconditional response-header operation
// owned by the host, with no storage dependency. It expires the same native
// Cookie when the authentication namespace could not be cleared atomically.
ClearAuthenticationCookie(w http.ResponseWriter, r *http.Request)
}
HostSession connects an existing host session's single Cookie owner.
ReplaceAuthentication must atomically compare the captured snapshot,
rotate the native session ID on login, and change/clear only the SDK auth
namespace. It must reject stale auth auto-save/touch after logout or account
change and preserve unrelated fields. An absent session returns a zero
snapshot. Host-owned Cookie attributes must satisfy the C0 production Cookie
contract. Ordinary Get/Set session libraries need a real atomic backend
bridge; declaring this interface does not confer distributed safety on them.

type HostSnapshot struct {
NativeID string
Version uint64
Handle string
}
HostSnapshot identifies the SDK namespace in an existing native server
session. Version is an authentication generation, independent of unrelated
application fields. NativeID and Handle are backend-only.

type Identifier struct {
Kind string `json:"kind"`
Value string `json:"value"`
Region *string `json:"region,omitempty"`
}

type LogoutResult struct {
Local string `json:"local"`
Cookie string `json:"cookie"`
Remote string `json:"remote"`
SSO string `json:"sso"`
}

type MFAInput struct {
Method string `json:"method"`
Code string `json:"code"`
}

type MagicInput struct {
TransactionID string `json:"transactionId"`
State string `json:"state"`
Proof string `json:"proof"`
}

type Memory struct {
// Has unexported fields.
}
Memory is a bounded, volatile, single-process Provider. Share one instance
between handlers and close it at application shutdown. It never evicts live
identities. Restart means reauthorization, not remote IAM revocation.

func NewMemory(opts MemoryOptions) (*Memory, error)

func (*Memory) Capabilities() Capabilities

func (m *Memory) Close() error

func (m *Memory) CompareAndSwap(ctx context.Context, id string, expected uint64, next Record) error

func (m *Memory) Create(ctx context.Context, id string, r Record) error

func (m *Memory) Invalidate(ctx context.Context, id string) (Record, error)

func (m *Memory) Load(ctx context.Context, id string) (Record, error)

func (m *Memory) Rotate(ctx context.Context, oldID string, expected uint64, newID string, next Record) error

type MemoryOptions struct {
MaxSessions, MaxPrelogins, MaxRecordBytes int
CleanupInterval time.Duration
Clock func() time.Time
}
MemoryOptions are finite per-process limits. Zero selects the C0 default;
negative values reject. Clock is optional and intended for deterministic
tests.

type Permissions struct {
Roles []string `json:"roles"`
Permissions []string `json:"permissions"`
}

type Provider interface {
Capabilities() Capabilities
Create(ctx context.Context, id string, record Record) error
Load(ctx context.Context, id string) (Record, error)
CompareAndSwap(ctx context.Context, id string, expected uint64, record Record) error
Rotate(ctx context.Context, oldID string, expected uint64, newID string, record Record) error
Invalidate(ctx context.Context, id string) (Record, error)
}
Provider owns only the SDK namespace. A normal session dictionary's Get/Set
does not satisfy this contract. CAS increments Version and rejects terminal
state, expired state, changed identity and extended absolute deadlines.
Rotate atomically terminates oldID and creates newID, or does neither.
Invalidate is terminal and returns the captured previous record for
revocation. It must fence every outstanding operation before returning.

type ProviderInput struct {
ProviderID string `json:"providerId"`
RegistrationGrantToken string `json:"registrationGrantToken,omitempty"`
RegistrationAccessCode string `json:"registrationAccessCode,omitempty"`
}

type Record struct {
SchemaVersion int
Version uint64
CreatedAt time.Time
AbsoluteExpiresAt time.Time
IdleExpiresAt time.Time
State string
Kind string // "prelogin" or "session"
ClientID string
Owner string
CSRF string
OAuthState string
Verifier string
Nonce string
ReturnTo string
TransactionID string
ControlSecret string
LoginState string
NextAction string
Identifier *Identifier
MagicConsumed bool
Registrations map[string]Registration
AccessToken string
RefreshToken string
AccessExpiresAt time.Time
Profile *iam.CurrentUser
Permissions *Permissions
Operation string
Fence string
LeaseExpiresAt time.Time
}
Record is sensitive server-side state, never a browser DTO. Providers must
isolate snapshots and fence stale saves, including framework automatic
saves. All times are absolute; CreatedAt and AbsoluteExpiresAt cannot be
extended.

func (Record) GoString() string

func (Record) String() string

type Registration struct {
ID string
ControlSecret string
ExpiresAt time.Time
}

type RegistrationView struct {
RegistrationID string `json:"registrationId"`
Status string `json:"status"`
ExpiresAt time.Time `json:"expiresAt"`
NextAction string `json:"nextAction"`
NextChallengeAt *time.Time `json:"nextChallengeAt"`
}

type Service struct {
// Has unexported fields.
}

func New(ctx context.Context, cfg Config) (*Service, error)
New validates explicit configuration and resolves pinned OIDC discovery
using ctx. No background network process or token retry is installed.

func (s *Service) Action(ctx context.Context, id, action string, input any) (string, View, error)
Action advances only the finite C0 login surface. It returns a replacement
binding only after a completed code exchange.

func (s *Service) Authenticate(ctx context.Context, id string) (View, error)
Authenticate explicitly refreshes if needed and performs one online validity
check. Context getters and permission checks never repeat this network work.

func (s *Service) BasePath() string

func (s *Service) Bootstrap(ctx context.Context, id string) (string, View, error)
Bootstrap returns a new binding only for known absent/expired state.
Provider failures propagate; an outage is never converted into an anonymous
success.

func (s *Service) Callback(ctx context.Context, id string, q url.Values) (string, View, string, error)
Callback validates the complete unique branch before atomically consuming
it. AUTH_CONTINUATION keeps the existing controlled custom transaction for
MFA.

func (s *Service) Handler() http.Handler
Handler serves the finite C0 host routes beneath BasePath. Mount the same
instance on any supported framework. It never proxies business URLs.

func (s *Service) Hosted(ctx context.Context, id, returnTo string) (string, error)
Hosted starts a bound top-level navigation after bootstrap. The provider CAS
binds exactly one attempt; it never replaces an authenticated identity.

func (s *Service) Login(ctx context.Context, id string) (View, error)
Login creates a custom transaction; proof collection alone cannot set a
user.

func (s *Service) Logout(ctx context.Context, id string) (LogoutResult, error)
Logout invalidates before remote I/O. It never refreshes to obtain logout
credentials, and RT revocation is never reported as session revocation.

func (s *Service) Middleware(next http.Handler) http.Handler
Middleware protects only explicitly mounted business endpoints. Mixing a
submitted Bearer/API key with Cookie auth is rejected; hosts choose their
credential routing before this middleware rather than falling back on error.

func (s *Service) PublicConfig(ctx context.Context, kind string) (any, error)
PublicConfig forwards only the two configured-client public DTOs.

func (s *Service) Register(ctx context.Context, id string, input SignupInput) (RegistrationView, int, error)
Register binds registration control to an opaque local reference. It never
promotes a registration response into an authenticated application session.

func (s *Service) RegistrationAction(ctx context.Context, id, ref, action, code string) (RegistrationView, error)

func (s *Service) RequestPasswordReset(ctx context.Context, email string) error

func (s *Service) ResetPassword(ctx context.Context, token, password string) error

type SignupInput struct {
Identifier Identifier `json:"identifier"`
Password string `json:"password"`
UILocales *string `json:"uiLocales,omitempty"`
RegistrationGrantToken string `json:"registrationGrantToken,omitempty"`
RegistrationAccessCode string `json:"registrationAccessCode,omitempty"`
OrganizationInvitationToken string `json:"organizationInvitationToken,omitempty"`
}

type View struct {
State string `json:"state"`
ExpiresAt time.Time `json:"expiresAt"`
CSRFToken string `json:"csrfToken"`
Owner string `json:"owner,omitempty"`
Version *uint64 `json:"version,omitempty"`
Profile *iam.CurrentUser `json:"profile,omitempty"`
Permissions *Permissions `json:"permissions,omitempty"`
NextAction string `json:"nextAction,omitempty"`
ChallengeExpiresAt *time.Time `json:"challengeExpiresAt,omitempty"`
CooldownSeconds *int `json:"cooldownSeconds,omitempty"`
AuthorizationURL string `json:"authorizationUrl,omitempty"`
}
View is the only browser session projection. It never contains OAuth or
transaction credentials. A proof-complete login has NextAction "complete"
and no Profile; it is not yet a signed-in application session.

func FromContext(ctx context.Context) *View
FromContext reads an isolated, already verified session without network I/O.

func ParseView(data []byte) (*View, error)
ParseView validates C0 browser views, including explicit nullable profile
fields and optional matching-context permission envelopes.


github.com/axis-iam/vertex-sdk-go/chi​

package iamchi // import "github.com/axis-iam/vertex-sdk-go/chi"

Package iamchi provides thin wrappers around the core net/http middleware for
chi-based applications. Because chi middleware already uses the http.Handler
signature, this package is intentionally minimal.

FUNCTIONS

func Authenticate(sdk *iam.SDK, opts ...iam.AuthOption) func(http.Handler) http.Handler
Authenticate forwards to (*iam.SDK).Authenticate.

func Install(r chi.Router, sdk *iam.SDK, opts ...iam.AuthOption)
Install registers the Authenticate middleware on r. Separate route groups
still compose the RequirePerm middleware themselves.

func RequireAllPerms(perms []authz.PermissionKey, opts ...middleware.Option) func(http.Handler) http.Handler
RequireAllPerms is an alias for middleware.RequireAllPerms.

func RequireAnyPerm(perms []authz.PermissionKey, opts ...middleware.Option) func(http.Handler) http.Handler
RequireAnyPerm is an alias for middleware.RequireAnyPerm.

func RequireNoImpersonation(opts ...middleware.Option) func(http.Handler) http.Handler
RequireNoImpersonation is an alias for middleware.RequireNoImpersonation.

func RequirePerm(perm authz.PermissionKey, opts ...middleware.Option) func(http.Handler) http.Handler
RequirePerm is an alias for middleware.RequirePerm exposed under the iamchi
package name so user code reads iamchi.RequirePerm(...).

func RequireStepUp(acr string, opts ...middleware.Option) func(http.Handler) http.Handler
RequireStepUp is an alias for middleware.RequireStepUp.

func WebSession(service *websession.Service) func(http.Handler) http.Handler
WebSession protects an explicitly selected business route using Cookie auth.

func WebSessionHandler(service *websession.Service) http.Handler
WebSessionHandler mounts the shared C0 routes without stripping BasePath.


github.com/axis-iam/vertex-sdk-go/gin​

package iamgin // import "github.com/axis-iam/vertex-sdk-go/gin"

Package iamgin exposes the IAM SDK as gin.HandlerFunc middleware.

FUNCTIONS

func Authenticate(sdk *iam.SDK, opts ...iam.AuthOption) gin.HandlerFunc
Authenticate validates the bearer token, resolves permissions, and stashes
the *authz.User in the gin context chain.

func RequireAllPerms(perms []authz.PermissionKey) gin.HandlerFunc
RequireAllPerms accepts the request only if the caller holds every perm.

func RequireAnyPerm(perms []authz.PermissionKey) gin.HandlerFunc
RequireAnyPerm accepts the request if the caller holds any of perms.

func RequireNoImpersonation() gin.HandlerFunc
RequireNoImpersonation blocks requests performed under an admin
impersonation token.

func RequirePerm(perm authz.PermissionKey) gin.HandlerFunc
RequirePerm rejects the request with 403 if the caller lacks perm.

func RequireStepUp(acr string) gin.HandlerFunc
RequireStepUp requires the JWT's acr claim to match acr.

func WebSession(service *websession.Service) gin.HandlerFunc
WebSession puts the verified identity in the native request context and
aborts the chain on failure. FromContext never performs implicit network
I/O.

func WebSessionHandler(service *websession.Service) gin.HandlerFunc
WebSessionHandler serves the same C0 routes as net/http. Mount on
/auth/*path (or the configured BasePath) without stripping the prefix.


github.com/axis-iam/vertex-sdk-go/echo​

package iamecho // import "github.com/axis-iam/vertex-sdk-go/echo"

Package iamecho exposes the IAM SDK as echo.MiddlewareFunc middleware.

FUNCTIONS

func Authenticate(sdk *iam.SDK, opts ...iam.AuthOption) echo.MiddlewareFunc
Authenticate validates the bearer token and stashes the *authz.User in the
echo request context.

func RequireAllPerms(perms []authz.PermissionKey) echo.MiddlewareFunc
RequireAllPerms accepts the request only if the caller holds every perm.

func RequireAnyPerm(perms []authz.PermissionKey) echo.MiddlewareFunc
RequireAnyPerm accepts the request if the caller holds any of perms.

func RequireNoImpersonation() echo.MiddlewareFunc
RequireNoImpersonation blocks impersonated sessions.

func RequirePerm(perm authz.PermissionKey) echo.MiddlewareFunc
RequirePerm rejects the request with 403 if the caller lacks perm.

func RequireStepUp(acr string) echo.MiddlewareFunc
RequireStepUp enforces an ACR level.

func WebSession(service *websession.Service) echo.MiddlewareFunc
func WebSessionHandler(service *websession.Service) echo.HandlerFunc