Documentation
¶
Index ¶
- Constants
- Variables
- type AccessControlType
- type ActorType
- type AllowList
- type AllowListEntry
- type AllowListUpdateRequest
- type AllowListUpdateResponse
- type AllowListUpdateResponseRecord
- type Application
- type ApplicationIDResponse
- type ApplicationResponse
- type ApplicationSubmission
- type ApplicationSubmissionResponse
- type AuditStatus
- type AuthContext
- type AuthenticatedUser
- func (u *AuthenticatedUser) GetCachedMemberID() (string, bool)
- func (u *AuthenticatedUser) GetCachedMemberIDError() error
- func (u *AuthenticatedUser) GetCachedMemberIDWithError() (memberID string, cached bool, err error)
- func (u *AuthenticatedUser) GetPermissions() []Permission
- func (u *AuthenticatedUser) GetPrimaryRole() Role
- func (u *AuthenticatedUser) HasAnyRole(roles ...Role) bool
- func (u *AuthenticatedUser) HasPermission(permission Permission) bool
- func (u *AuthenticatedUser) HasRole(role Role) bool
- func (u *AuthenticatedUser) IsAdmin() bool
- func (u *AuthenticatedUser) IsMember() bool
- func (u *AuthenticatedUser) IsSystem() bool
- func (u *AuthenticatedUser) IsTokenExpired() bool
- func (u *AuthenticatedUser) SetCachedMemberID(memberID string, err error)
- type AuthorizationMode
- type BaseModel
- type CollectionResponse
- type CreateApplicationRequest
- type CreateApplicationSubmissionRequest
- type CreateMemberRequest
- type CreateSchemaRequest
- type CreateSchemaSubmissionRequest
- type EndpointPermission
- type FlexibleStringSlice
- type GrantDurationType
- type Member
- type MemberResponse
- type Owner
- type Permission
- type PolicyMetadataCreateRequest
- type PolicyMetadataCreateRequestRecord
- type PolicyMetadataCreateResponse
- type PolicyMetadataResponse
- type ResourceType
- type Role
- type Schema
- type SchemaResponse
- type SchemaSubmission
- type SchemaSubmissionResponse
- type SelectedFieldRecord
- type SelectedFieldRecords
- type Source
- type Status
- type TargetType
- type UpdateApplicationPolicyRequest
- type UpdateApplicationRequest
- type UpdateApplicationSubmissionRequest
- type UpdateMemberRequest
- type UpdateSchemaRequest
- type UpdateSchemaSubmissionRequest
- type UserClaims
- func (c *UserClaims) GetAudience() (jwt.ClaimStrings, error)
- func (c *UserClaims) GetExpirationTime() (*jwt.NumericDate, error)
- func (c *UserClaims) GetIssuedAt() (*jwt.NumericDate, error)
- func (c *UserClaims) GetIssuer() (string, error)
- func (c *UserClaims) GetNotBefore() (*jwt.NumericDate, error)
- func (c *UserClaims) GetSubject() (string, error)
- type UserGroup
- type Version
Constants ¶
const ( MaxNameLength = 255 MaxDescriptionLength = 1000 MaxEmailLength = 320 // RFC 3696 specification MaxPhoneLength = 15 // E.164 format MaxEndpointLength = 2048 )
Field length constraints remain as regular constants
const (
TemplateIDM2M = "m2m-application"
)
IDP Application Constants
Variables ¶
var EndpointPermissions = []EndpointPermission{ {"GET", "/api/v1/schemas", PermissionReadSchema, false}, {"POST", "/api/v1/schemas", PermissionCreateSchema, false}, {"GET", "/api/v1/schemas/*", PermissionReadSchema, true}, {"PUT", "/api/v1/schemas/*", PermissionUpdateSchema, true}, {"DELETE", "/api/v1/schemas/*", PermissionDeleteSchema, true}, {"GET", "/api/v1/schema-submissions", PermissionReadSchemaSubmission, false}, {"POST", "/api/v1/schema-submissions", PermissionCreateSchemaSubmission, false}, {"GET", "/api/v1/schema-submissions/*", PermissionReadSchemaSubmission, true}, {"PUT", "/api/v1/schema-submissions/*", PermissionUpdateSchemaSubmission, true}, {"GET", "/api/v1/applications", PermissionReadApplication, false}, {"POST", "/api/v1/applications", PermissionCreateApplication, false}, {"GET", "/api/v1/applications/*", PermissionReadApplication, true}, {"PUT", "/api/v1/applications/*", PermissionUpdateApplication, true}, {"DELETE", "/api/v1/applications/*", PermissionDeleteApplication, true}, {"GET", "/api/v1/application-submissions", PermissionReadApplicationSubmission, false}, {"POST", "/api/v1/application-submissions", PermissionCreateApplicationSubmission, false}, {"GET", "/api/v1/application-submissions/*", PermissionReadApplicationSubmission, true}, {"PUT", "/api/v1/application-submissions/*", PermissionUpdateApplicationSubmission, true}, {"GET", "/api/v1/members", PermissionReadMember, false}, {"POST", "/api/v1/members", PermissionCreateMember, false}, {"GET", "/api/v1/members/*", PermissionReadMember, true}, {"PUT", "/api/v1/members/*", PermissionUpdateMember, true}, }
EndpointPermissions maps HTTP endpoints to required permissions
var RolePermissions = map[Role][]Permission{ RoleAdmin: { PermissionCreateSchema, PermissionReadSchema, PermissionUpdateSchema, PermissionDeleteSchema, PermissionReadAllSchemas, PermissionCreateSchemaSubmission, PermissionReadSchemaSubmission, PermissionUpdateSchemaSubmission, PermissionDeleteSchemaSubmission, PermissionReadAllSchemaSubmissions, PermissionApproveSchemaSubmission, PermissionCreateApplication, PermissionReadApplication, PermissionUpdateApplication, PermissionDeleteApplication, PermissionReadAllApplications, PermissionCreateApplicationSubmission, PermissionReadApplicationSubmission, PermissionUpdateApplicationSubmission, PermissionDeleteApplicationSubmission, PermissionReadAllApplicationSubmissions, PermissionApproveApplicationSubmission, PermissionCreateMember, PermissionReadMember, PermissionUpdateMember, PermissionDeleteMember, PermissionReadAllMembers, }, RoleMember: { PermissionCreateSchema, PermissionReadSchema, PermissionUpdateSchema, PermissionCreateSchemaSubmission, PermissionReadSchemaSubmission, PermissionUpdateSchemaSubmission, PermissionCreateApplication, PermissionReadApplication, PermissionUpdateApplication, PermissionCreateApplicationSubmission, PermissionReadApplicationSubmission, PermissionUpdateApplicationSubmission, PermissionReadMember, PermissionUpdateMember, }, RoleSystem: { PermissionReadSchema, PermissionReadAllSchemas, PermissionReadSchemaSubmission, PermissionReadAllSchemaSubmissions, PermissionReadApplication, PermissionReadAllApplications, PermissionReadApplicationSubmission, PermissionReadAllApplicationSubmissions, PermissionReadMember, PermissionReadAllMembers, }, }
RolePermissions defines what permissions each role has
Functions ¶
This section is empty.
Types ¶
type AccessControlType ¶
type AccessControlType string
AccessControlType represents the access control type enum
const ( AccessControlTypePublic AccessControlType = "public" AccessControlTypeRestricted AccessControlType = "restricted" )
func (*AccessControlType) Scan ¶
func (act *AccessControlType) Scan(value interface{}) error
Scan implements the sql.Scanner interface for AccessControlType
type AllowList ¶
type AllowList map[string]AllowListEntry
AllowList represents the JSONB allow list as a HashMap with custom scanning Key: application_id, Value: AllowListEntry
type AllowListEntry ¶
type AllowListEntry struct {
ExpiresAt time.Time `json:"expires_at"`
UpdatedAt time.Time `json:"updated_at"`
}
AllowListEntry represents an entry in the allow list
type AllowListUpdateRequest ¶
type AllowListUpdateRequest struct {
ApplicationID string `json:"applicationId" validate:"required"`
Records []SelectedFieldRecord `json:"records" validate:"required,dive"`
GrantDuration GrantDurationType `json:"grantDuration" validate:"required,grant_duration_type_enum"`
}
AllowListUpdateRequest represents the request to update allow list
type AllowListUpdateResponse ¶
type AllowListUpdateResponse struct {
Records []AllowListUpdateResponseRecord `json:"records"`
}
AllowListUpdateResponse represents the response from allow list update
type AllowListUpdateResponseRecord ¶
type AllowListUpdateResponseRecord struct {
FieldName string `json:"fieldName"`
SchemaID string `json:"schemaId"`
ExpiresAt string `json:"expiresAt"`
UpdatedAt string `json:"updatedAt"`
}
AllowListUpdateResponseRecord represents one record in the allow list update response
type Application ¶
type Application struct {
ApplicationID string `gorm:"primarykey;column:application_id" json:"applicationId"`
ApplicationName string `gorm:"column:application_name;not null" json:"applicationName"`
ApplicationDescription *string `gorm:"column:application_description" json:"applicationDescription,omitempty"`
SelectedFields SelectedFieldRecords `gorm:"column:selected_fields;type:jsonb;not null" json:"selectedFields"`
MemberID string `gorm:"column:member_id;not null" json:"memberId"`
Version string `gorm:"column:version;not null" json:"version"`
IdpApplicationID *string `gorm:"column:idp_application_id" json:"idpApplicationId,omitempty"` // Until the data migration is done this can be nullable
IdpClientID *string `gorm:"column:idp_client_id" json:"idpClientId,omitempty"` // Until the data migration is done this can be nullable
BaseModel
// Relationships
Member Member `gorm:"foreignKey:MemberID;references:MemberID" json:"member"`
}
Application represents the consumer_applications table
func (Application) TableName ¶
func (Application) TableName() string
TableName sets the table name for GORM
type ApplicationIDResponse ¶
type ApplicationIDResponse struct {
ApplicationID string `json:"applicationId"`
}
type ApplicationResponse ¶
type ApplicationResponse struct {
ApplicationID string `json:"applicationId"`
ApplicationName string `json:"applicationName"`
ApplicationDescription *string `json:"applicationDescription,omitempty"`
SelectedFields []SelectedFieldRecord `json:"selectedFields"`
MemberID string `json:"memberId"`
Version string `json:"version"`
IdpApplicationID *string `json:"idpApplicationId,omitempty"`
IdpClientID *string `json:"idpClientId,omitempty"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type ApplicationSubmission ¶
type ApplicationSubmission struct {
SubmissionID string `gorm:"primarykey;column:submission_id" json:"submissionId"`
PreviousApplicationID *string `gorm:"column:previous_application_id" json:"previousApplicationId,omitempty"`
ApplicationName string `gorm:"column:application_name;not null" json:"applicationName"`
ApplicationDescription *string `gorm:"column:application_description" json:"applicationDescription,omitempty"`
SelectedFields SelectedFieldRecords `gorm:"column:selected_fields;type:jsonb;not null" json:"selectedFields"`
MemberID string `gorm:"column:member_id;not null" json:"memberId"`
Status string `gorm:"column:status;not null" json:"status"`
Review *string `gorm:"column:review" json:"review,omitempty"`
BaseModel
// Relationships
Member Member `gorm:"foreignKey:MemberID;references:MemberID" json:"member"`
PreviousApplication *Application `gorm:"foreignKey:PreviousApplicationID;references:ApplicationID" json:"previousApplication,omitempty"`
}
ApplicationSubmission represents the consumer_application_submissions table
func (ApplicationSubmission) TableName ¶
func (ApplicationSubmission) TableName() string
TableName sets the table name for GORM
type ApplicationSubmissionResponse ¶
type ApplicationSubmissionResponse struct {
SubmissionID string `json:"submissionId"`
PreviousApplicationID *string `json:"previousApplicationId,omitempty"`
ApplicationName string `json:"applicationName"`
ApplicationDescription *string `json:"applicationDescription,omitempty"`
SelectedFields []SelectedFieldRecord `json:"selectedFields"`
MemberID string `json:"memberId"`
Status string `json:"status"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Review *string `json:"review,omitempty"`
}
type AuditStatus ¶
type AuditStatus string
AuditStatus represents the status of audit events
const ( AuditStatusSuccess AuditStatus = "SUCCESS" AuditStatusFailure AuditStatus = "FAILURE" )
type AuthContext ¶
type AuthContext struct {
User *AuthenticatedUser `json:"user"`
Token string `json:"-"` // Don't expose in JSON
IssuedBy string `json:"issuedBy"`
Audience []string `json:"audience"`
Permissions []Permission `json:"permissions"`
}
AuthContext represents the authentication context in HTTP requests
type AuthenticatedUser ¶
type AuthenticatedUser struct {
IdpUserID string `json:"idpUserId"`
Email string `json:"email"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
PhoneNumber string `json:"phoneNumber"`
Roles []Role `json:"roles"`
Groups []string `json:"groups"`
IssuedAt time.Time `json:"issuedAt"`
ExpiresAt time.Time `json:"expiresAt"`
// contains filtered or unexported fields
}
AuthenticatedUser represents the authenticated user context
func NewAuthenticatedUser ¶
func NewAuthenticatedUser(claims *UserClaims) (*AuthenticatedUser, error)
NewAuthenticatedUser creates a new authenticated user from JWT claims Returns an error if no valid roles are found in the claims
func (*AuthenticatedUser) GetCachedMemberID ¶
func (u *AuthenticatedUser) GetCachedMemberID() (string, bool)
GetCachedMemberID returns the cached member ID if available Thread-safe using read lock
func (*AuthenticatedUser) GetCachedMemberIDError ¶
func (u *AuthenticatedUser) GetCachedMemberIDError() error
GetCachedMemberIDError returns the cached error from member ID lookup Thread-safe using read lock
func (*AuthenticatedUser) GetCachedMemberIDWithError ¶
func (u *AuthenticatedUser) GetCachedMemberIDWithError() (memberID string, cached bool, err error)
GetCachedMemberIDWithError atomically returns both the cached member ID and error state This ensures consistency when reading both values together
func (*AuthenticatedUser) GetPermissions ¶
func (u *AuthenticatedUser) GetPermissions() []Permission
GetPermissions returns all permissions the user has based on their roles Uses cached permissions computed during user creation for optimal performance
func (*AuthenticatedUser) GetPrimaryRole ¶
func (u *AuthenticatedUser) GetPrimaryRole() Role
GetPrimaryRole returns the highest priority role (Admin > System > Member)
func (*AuthenticatedUser) HasAnyRole ¶
func (u *AuthenticatedUser) HasAnyRole(roles ...Role) bool
HasAnyRole checks if the user has any of the specified roles
func (*AuthenticatedUser) HasPermission ¶
func (u *AuthenticatedUser) HasPermission(permission Permission) bool
HasPermission checks if the user has a specific permission based on their roles
func (*AuthenticatedUser) HasRole ¶
func (u *AuthenticatedUser) HasRole(role Role) bool
HasRole checks if the user has a specific role
func (*AuthenticatedUser) IsAdmin ¶
func (u *AuthenticatedUser) IsAdmin() bool
IsAdmin checks if the user has admin role
func (*AuthenticatedUser) IsMember ¶
func (u *AuthenticatedUser) IsMember() bool
IsMember checks if the user has member role
func (*AuthenticatedUser) IsSystem ¶
func (u *AuthenticatedUser) IsSystem() bool
IsSystem checks if the user has system role
func (*AuthenticatedUser) IsTokenExpired ¶
func (u *AuthenticatedUser) IsTokenExpired() bool
IsTokenExpired checks if the user's token is expired
func (*AuthenticatedUser) SetCachedMemberID ¶
func (u *AuthenticatedUser) SetCachedMemberID(memberID string, err error)
SetCachedMemberID sets the cached member ID and error state Thread-safe using write lock
type AuthorizationMode ¶
type AuthorizationMode string
AuthorizationMode defines how the system behaves when no explicit permission is defined for an endpoint
const ( // AuthorizationModeFailClosed - Deny all access to undefined endpoints (most secure) AuthorizationModeFailClosed AuthorizationMode = "fail_closed" // AuthorizationModeFailOpenAdminSystem - Allow admin and system users, deny others (current behavior) AuthorizationModeFailOpenAdminSystem AuthorizationMode = "fail_open_admin_system" // AuthorizationModeFailOpenAdmin - Allow only admin users, deny others AuthorizationModeFailOpenAdmin AuthorizationMode = "fail_open_admin" )
type BaseModel ¶
type BaseModel struct {
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP" json:"updatedAt"`
}
BaseModel contains common fields for all models
func (*BaseModel) BeforeCreate ¶
BeforeCreate GORM hook for BaseModel
type CollectionResponse ¶
type CollectionResponse struct {
Items interface{} `json:"items"`
Count int `json:"count"`
}
CollectionResponse Generic collection response
type CreateApplicationRequest ¶
type CreateApplicationRequest struct {
ApplicationName string `json:"applicationName" validate:"required"`
ApplicationDescription *string `json:"applicationDescription,omitempty"`
SelectedFields []SelectedFieldRecord `json:"selectedFields" validate:"required,min=1"`
MemberID string `json:"memberId" validate:"required"`
// IdpApplicationID and IdpClientID let a caller register an application whose
// OAuth2 client was already provisioned directly in the IDP (e.g. manually via
// ThunderID's console, since idpfactory only implements Asgardeo's admin API
// today - see internal/pb/idp/idpfactory). When both are set, creation skips
// calling the IDP entirely and uses these values as-is. Must be provided
// together (both or neither) - a single field alone is rejected.
IdpApplicationID *string `json:"idpApplicationId,omitempty"`
IdpClientID *string `json:"idpClientId,omitempty"`
}
CreateApplicationRequest creates a new consumer application
type CreateApplicationSubmissionRequest ¶
type CreateApplicationSubmissionRequest struct {
ApplicationName string `json:"applicationName" validate:"required"`
ApplicationDescription *string `json:"applicationDescription,omitempty"`
SelectedFields []SelectedFieldRecord `json:"selectedFields" validate:"required,min=1"`
PreviousApplicationID *string `json:"previousApplicationId,omitempty"`
MemberID string `json:"memberId" validate:"required"`
}
CreateApplicationSubmissionRequest Consumer Application Submission DTOs
type CreateMemberRequest ¶
type CreateMemberRequest struct {
Name string `json:"name" validate:"required"`
Email string `json:"email" validate:"required,email"`
PhoneNumber string `json:"phoneNumber" validate:"required"`
// IdpUserID lets a caller register a member whose IDP account was already
// provisioned directly (e.g. manually via ThunderID's console, since
// idpfactory only implements Asgardeo's admin API today - see
// internal/pb/idp/idpfactory). When set, creation skips creating the user
// and assigning them to the member group in the IDP entirely, and uses
// this value as-is - the caller is responsible for that group/role
// assignment having already happened.
IdpUserID *string `json:"idpUserId,omitempty"`
}
type CreateSchemaRequest ¶
type CreateSchemaRequest struct {
SchemaName string `json:"schemaName" validate:"required"`
SchemaDescription *string `json:"schemaDescription,omitempty"`
// SDL is a GraphQL SDL string annotated with @accessControl/@source (and
// optionally @displayName/@description/@isOwner/@owner) directives, parsed
// into policy metadata records. Mutually exclusive with Fields.
SDL string `json:"sdl,omitempty"`
// Fields lets a caller declare policy metadata records directly, skipping
// SDL/GraphQL parsing entirely - each FieldName is used as-is (no forced
// typename.fieldName prefix the way SDL-derived field paths get).
// Mutually exclusive with SDL.
Fields []PolicyMetadataCreateRequestRecord `json:"fields,omitempty"`
Endpoint string `json:"endpoint" validate:"required"`
MemberID string `json:"memberId" validate:"required"`
}
CreateSchemaRequest creates a new provider schema. Exactly one of SDL or Fields must be provided.
type CreateSchemaSubmissionRequest ¶
type CreateSchemaSubmissionRequest struct {
SchemaName string `json:"schemaName" validate:"required"`
SchemaDescription *string `json:"schemaDescription,omitempty"`
SDL string `json:"sdl" validate:"required"`
SchemaEndpoint string `json:"schemaEndpoint" validate:"required"`
PreviousSchemaID *string `json:"previousSchemaId,omitempty"`
MemberID string `json:"memberId" validate:"required"`
}
CreateSchemaSubmissionRequest Provider Schema Submission DTOs
type EndpointPermission ¶
type EndpointPermission struct {
Method string
Path string
Permission Permission
IsOwnershipRequired bool // Whether the user must own the resource
}
EndpointPermission defines the required permission for each endpoint
type FlexibleStringSlice ¶
type FlexibleStringSlice []string
FlexibleStringSlice can unmarshal both single string and string array from JSON
func (*FlexibleStringSlice) ToStringSlice ¶
func (f *FlexibleStringSlice) ToStringSlice() []string
ToStringSlice converts to regular string slice
func (*FlexibleStringSlice) UnmarshalJSON ¶
func (f *FlexibleStringSlice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom unmarshaling to handle both string and []string
type GrantDurationType ¶
type GrantDurationType string
GrantDurationType represents the grant duration type enum
const ( GrantDurationTypeOneMonth GrantDurationType = "30d" GrantDurationTypeOneYear GrantDurationType = "365d" )
type Member ¶
type Member struct {
MemberID string `gorm:"primarykey;column:member_id" json:"memberId"`
Name string `gorm:"column:name;not null" json:"name"`
Email string `gorm:"column:email;not null;unique" json:"email"`
PhoneNumber string `gorm:"column:phone_number;not null" json:"phoneNumber"`
IdpUserID string `gorm:"column:idp_user_id;not null;unique" json:"idpUserId"`
BaseModel
}
Member represents the normalized entity table
type MemberResponse ¶
type MemberResponse struct {
MemberID string `json:"memberId"`
Name string `json:"name"`
Email string `json:"email"`
PhoneNumber string `json:"phoneNumber"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
IdpUserID string `json:"idpUserId"`
}
func (*MemberResponse) ToMember ¶
func (e *MemberResponse) ToMember() Member
ToMember converts a MemberResponse to a Member model (for internal use)
type Owner ¶
type Owner string
Owner represents the owner enum
const (
OwnerCitizen Owner = "citizen"
)
type Permission ¶
type Permission string
Permission represents specific permissions
const ( // Schema permissions PermissionCreateSchema Permission = "schema:create" PermissionReadSchema Permission = "schema:read" PermissionUpdateSchema Permission = "schema:update" PermissionDeleteSchema Permission = "schema:delete" PermissionReadAllSchemas Permission = "schema:read:all" // Schema submission permissions PermissionCreateSchemaSubmission Permission = "schema_submission:create" PermissionReadSchemaSubmission Permission = "schema_submission:read" PermissionUpdateSchemaSubmission Permission = "schema_submission:update" PermissionDeleteSchemaSubmission Permission = "schema_submission:delete" PermissionReadAllSchemaSubmissions Permission = "schema_submission:read:all" PermissionApproveSchemaSubmission Permission = "schema_submission:approve" // Application permissions PermissionCreateApplication Permission = "application:create" PermissionReadApplication Permission = "application:read" PermissionUpdateApplication Permission = "application:update" PermissionDeleteApplication Permission = "application:delete" PermissionReadAllApplications Permission = "application:read:all" // Application submission permissions PermissionCreateApplicationSubmission Permission = "application_submission:create" PermissionReadApplicationSubmission Permission = "application_submission:read" PermissionUpdateApplicationSubmission Permission = "application_submission:update" PermissionDeleteApplicationSubmission Permission = "application_submission:delete" PermissionReadAllApplicationSubmissions Permission = "application_submission:read:all" PermissionApproveApplicationSubmission Permission = "application_submission:approve" // Member permissions PermissionCreateMember Permission = "member:create" PermissionReadMember Permission = "member:read" PermissionUpdateMember Permission = "member:update" PermissionDeleteMember Permission = "member:delete" PermissionReadAllMembers Permission = "member:read:all" )
type PolicyMetadataCreateRequest ¶
type PolicyMetadataCreateRequest struct {
SchemaID string `json:"schemaId" validate:"required"`
Records []PolicyMetadataCreateRequestRecord `json:"records" validate:"required,dive"`
}
PolicyMetadataCreateRequest represents the request to create policy metadata
type PolicyMetadataCreateRequestRecord ¶
type PolicyMetadataCreateRequestRecord struct {
FieldName string `json:"fieldName" validate:"required"`
DisplayName *string `json:"displayName,omitempty"`
Description *string `json:"description,omitempty"`
Source Source `json:"source" validate:"required,source_enum"`
IsOwner bool `json:"isOwner" validate:"required"`
AccessControlType AccessControlType `json:"accessControlType" validate:"required,access_control_type_enum"`
Owner *Owner `json:"owner,omitempty" validate:"omitempty,owner_enum"`
}
PolicyMetadataCreateRequestRecord represents the request to create policy metadata
type PolicyMetadataCreateResponse ¶
type PolicyMetadataCreateResponse struct {
Records []PolicyMetadataResponse `json:"records"`
}
PolicyMetadataCreateResponse represents the response from policy metadata creation
type PolicyMetadataResponse ¶
type PolicyMetadataResponse struct {
ID string `json:"id"`
SchemaID string `json:"schemaId"`
FieldName string `json:"fieldName"`
DisplayName *string `json:"displayName,omitempty"`
Description *string `json:"description,omitempty"`
Source Source `json:"source"`
IsOwner bool `json:"isOwner"`
AccessControlType AccessControlType `json:"accessControlType"`
AllowList AllowList `json:"allowList"`
Owner *Owner `json:"owner,omitempty"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
PolicyMetadataResponse represents the response from policy metadata operations
type ResourceType ¶
type ResourceType string
ResourceType represents different resource types for auditing
const ( ResourceTypeMembers ResourceType = "MEMBERS" ResourceTypeSchemas ResourceType = "SCHEMAS" ResourceTypeSchemaSubmissions ResourceType = "SCHEMA-SUBMISSIONS" ResourceTypeApplications ResourceType = "APPLICATIONS" ResourceTypeApplicationSubmissions ResourceType = "APPLICATION-SUBMISSIONS" )
type Role ¶
type Role string
Role represents user roles in the system
func (Role) HasPermission ¶
func (r Role) HasPermission(permission Permission) bool
HasPermission checks if a role has a specific permission
type Schema ¶
type Schema struct {
SchemaID string `gorm:"primarykey;column:schema_id" json:"schemaId"`
MemberID string `gorm:"column:member_id;not null" json:"memberId"`
SchemaName string `gorm:"column:schema_name;not null" json:"schemaName"`
SDL string `gorm:"column:sdl;not null" json:"sdl"`
Endpoint string `gorm:"column:endpoint;not null" json:"endpoint"`
Version string `gorm:"column:version;not null" json:"version"`
SchemaDescription *string `gorm:"column:schema_description" json:"schemaDescription,omitempty"`
BaseModel
// Relationships
Member Member `gorm:"foreignKey:MemberID;references:MemberID" json:"member"`
}
Schema represents the provider_schemas table
type SchemaResponse ¶
type SchemaResponse struct {
SchemaID string `json:"schemaId"`
MemberID string `json:"memberId"`
SchemaName string `json:"schemaName"`
SDL string `json:"sdl"`
Endpoint string `json:"endpoint"`
Version string `json:"version"`
SchemaDescription *string `json:"schemaDescription,omitempty"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type SchemaSubmission ¶
type SchemaSubmission struct {
SubmissionID string `gorm:"primarykey;column:submission_id" json:"submissionId"`
PreviousSchemaID *string `gorm:"column:previous_schema_id" json:"previousSchemaId,omitempty"`
SchemaName string `gorm:"column:schema_name;not null" json:"schemaName"`
SchemaDescription *string `gorm:"column:schema_description" json:"schemaDescription,omitempty"`
SDL string `gorm:"column:sdl;not null" json:"sdl"`
SchemaEndpoint string `gorm:"column:schema_endpoint;not null" json:"schemaEndpoint"`
Status string `gorm:"column:status;not null" json:"status"`
MemberID string `gorm:"column:member_id;not null" json:"memberId"`
Review *string `gorm:"column:review" json:"review,omitempty"`
BaseModel
// Relationships
Member Member `gorm:"foreignKey:MemberID;references:MemberID" json:"member"`
PreviousSchema *Schema `gorm:"foreignKey:PreviousSchemaID;references:SchemaID" json:"previousSchema,omitempty"`
}
SchemaSubmission represents the provider_schema_submissions table
func (SchemaSubmission) TableName ¶
func (SchemaSubmission) TableName() string
TableName sets the table name for GORM
type SchemaSubmissionResponse ¶
type SchemaSubmissionResponse struct {
SubmissionID string `json:"submissionId"`
PreviousSchemaID *string `json:"previousSchemaId,omitempty"`
SchemaName string `json:"schemaName"`
SchemaDescription *string `json:"schemaDescription,omitempty"`
SDL string `json:"sdl"`
SchemaEndpoint string `json:"schemaEndpoint"`
Status string `json:"status"`
MemberID string `json:"memberId"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Review *string `json:"review,omitempty"`
}
type SelectedFieldRecord ¶
type SelectedFieldRecord struct {
FieldName string `json:"fieldName"`
SchemaID string `json:"schemaId"`
}
SelectedFieldRecord represents a record in the selected_fields array
type SelectedFieldRecords ¶
type SelectedFieldRecords []SelectedFieldRecord
SelectedFieldRecords represents an array of SelectedFieldRecord with custom scanning
func (SelectedFieldRecords) GormDataType ¶
func (SelectedFieldRecords) GormDataType() string
GormDataType gorm common data type
func (*SelectedFieldRecords) Scan ¶
func (sfr *SelectedFieldRecords) Scan(value interface{}) error
Scan implements the sql.Scanner interface for SelectedFieldRecords
type Source ¶
type Source string
Source represents the source enum
type TargetType ¶
type TargetType string
TargetType represents different target types for auditing
const ( TargetTypeService TargetType = "SERVICE" TargetTypeResource TargetType = "RESOURCE" )
type UpdateApplicationPolicyRequest ¶
type UpdateApplicationPolicyRequest struct {
SelectedFields []SelectedFieldRecord `json:"selectedFields" validate:"required,min=1"`
GrantDuration *GrantDurationType `json:"grantDuration,omitempty" validate:"omitempty,grant_duration_type_enum"`
}
UpdateApplicationPolicyRequest replaces an existing application's allow-list (its requested schema fields and their PDP grant duration).
type UpdateApplicationRequest ¶
type UpdateApplicationRequest struct {
ApplicationName *string `json:"applicationName,omitempty"`
ApplicationDescription *string `json:"applicationDescription,omitempty"`
Version *string `json:"version,omitempty"`
}
UpdateApplicationRequest updates an existing consumer application
type UpdateApplicationSubmissionRequest ¶
type UpdateApplicationSubmissionRequest struct {
ApplicationName *string `json:"applicationName,omitempty"`
ApplicationDescription *string `json:"applicationDescription,omitempty"`
SelectedFields *[]SelectedFieldRecord `json:"selectedFields,omitempty"`
Status *string `json:"status,omitempty"`
PreviousApplicationID *string `json:"previousApplicationId,omitempty"`
Review *string `json:"review,omitempty"`
}
UpdateApplicationSubmissionRequest updates the status of a consumer application submission
type UpdateMemberRequest ¶
type UpdateSchemaRequest ¶
type UpdateSchemaRequest struct {
SchemaName *string `json:"schemaName,omitempty"`
SchemaDescription *string `json:"schemaDescription,omitempty"`
SDL *string `json:"sdl,omitempty"`
Endpoint *string `json:"endpoint,omitempty"`
Version *string `json:"version,omitempty"`
}
UpdateSchemaRequest updates an existing provider schema
type UpdateSchemaSubmissionRequest ¶
type UpdateSchemaSubmissionRequest struct {
SchemaName *string `json:"schemaName,omitempty"`
SchemaDescription *string `json:"schemaDescription,omitempty"`
SDL *string `json:"sdl,omitempty"`
SchemaEndpoint *string `json:"schemaEndpoint,omitempty"`
Status *string `json:"status,omitempty"`
PreviousSchemaID *string `json:"previousSchemaId,omitempty"`
Review *string `json:"review,omitempty"`
}
UpdateSchemaSubmissionRequest updates the status of a provider schema submission
type UserClaims ¶
type UserClaims struct {
Email string `json:"email"`
FirstName string `json:"given_name"`
LastName string `json:"family_name"`
PhoneNumber string `json:"phone_number"`
Roles FlexibleStringSlice `json:"roles"`
Groups FlexibleStringSlice `json:"groups"`
IdpUserID string `json:"sub"` // Subject is typically the user ID from IdP
// Standard JWT claims - using int64 for Unix timestamps
Issuer string `json:"iss"`
Audience FlexibleStringSlice `json:"aud"`
ExpiresAt int64 `json:"exp"`
IssuedAt int64 `json:"iat"`
NotBefore int64 `json:"nbf"`
}
UserClaims represents the JWT claims for a user
func (*UserClaims) GetAudience ¶
func (c *UserClaims) GetAudience() (jwt.ClaimStrings, error)
GetAudience implements jwt.Claims interface
func (*UserClaims) GetExpirationTime ¶
func (c *UserClaims) GetExpirationTime() (*jwt.NumericDate, error)
GetExpirationTime implements jwt.Claims interface
func (*UserClaims) GetIssuedAt ¶
func (c *UserClaims) GetIssuedAt() (*jwt.NumericDate, error)
GetIssuedAt implements jwt.Claims interface
func (*UserClaims) GetIssuer ¶
func (c *UserClaims) GetIssuer() (string, error)
GetIssuer implements jwt.Claims interface
func (*UserClaims) GetNotBefore ¶
func (c *UserClaims) GetNotBefore() (*jwt.NumericDate, error)
GetNotBefore implements jwt.Claims interface
func (*UserClaims) GetSubject ¶
func (c *UserClaims) GetSubject() (string, error)
GetSubject implements jwt.Claims interface