Documentation
¶
Index ¶
- Constants
- Variables
- func CheckReadUser(ctx context.Context) error
- func ValidateContent(ctx context.Context, scopeSlot string, expectedScope string) error
- type APIUsersPatchCustomData
- type APIUsersPostReq
- type APIUsersPostRes
- type APIUsersSearchRes
- type AccessTokenResp
- type AdditionalUserInformation
- type CustomTime
- type LogtoClient
- type LogtoClientParams
- type NoopClient
- func (NoopClient) AccessToken() (*AccessTokenResp, error)
- func (NoopClient) AddCustomUserInformation(string, string, *APIUsersPatchCustomData) error
- func (NoopClient) CheckUser(string) (bool, string, error)
- func (NoopClient) CheckUserWithUserName(string) (bool, string, error)
- func (NoopClient) CreateUser(string, *APIUsersPostReq) (string, error)
- func (NoopClient) Permissions(string) ([]*PermissionResp, error)
- func (NoopClient) Roles(string) ([]*RoleResp, error)
- func (NoopClient) User(string) (*UserResp, error)
- func (NoopClient) UserWithEmail(string) (*UserResp, error)
- type PermissionResp
- type RoleResp
- type UserResp
Constants ¶
View Source
const ( ContentCreatorScope = "write:content" ContentEditorScope = "edit:content" ContentDeleteScope = "delete:content" )
Variables ¶
View Source
var ErrAuthDisabled = errors.New("authentication is disabled")
ErrAuthDisabled is returned by every NoopClient method. It surfaces as a regular GraphQL error for resolvers that need the Logto management API, which is the intended behavior when the server runs with auth disabled.
Functions ¶
func CheckReadUser ¶
Types ¶
type APIUsersPatchCustomData ¶
type APIUsersPatchCustomData struct {
CustomData AdditionalUserInformation `json:"customData"`
}
type APIUsersPostReq ¶
type APIUsersPostRes ¶
type APIUsersPostRes struct {
ID string `json:"id"`
}
type APIUsersSearchRes ¶
type AccessTokenResp ¶
type AdditionalUserInformation ¶
type AdditionalUserInformation struct {
Profession string `json:"profession"`
JobTitle string `json:"job_title"`
Institution string `json:"institution"`
Address string `json:"address"`
SecondaryAddress string `json:"secondary_address"`
City string `json:"city"`
State string `json:"state"`
Region string `json:"region"`
Country string `json:"country"`
Zipcode string `json:"zipcode"`
Subscribed bool `json:"subscribed"`
ResearchInterest string `json:"research_interest"`
Phone string `json:"phone"`
}
type CustomTime ¶
func (*CustomTime) UnmarshalJSON ¶
func (ct *CustomTime) UnmarshalJSON(input []byte) error
type LogtoClient ¶
type LogtoClient interface {
AccessToken() (*AccessTokenResp, error)
CheckUserWithUserName(string) (bool, string, error)
UserWithEmail(string) (*UserResp, error)
CheckUser(string) (bool, string, error)
AddCustomUserInformation(string, string, *APIUsersPatchCustomData) error
User(string) (*UserResp, error)
Roles(string) ([]*RoleResp, error)
Permissions(string) ([]*PermissionResp, error)
CreateUser(string, *APIUsersPostReq) (string, error)
}
func NewClient ¶
func NewClient(params *LogtoClientParams) LogtoClient
NewClient creates a new instance of the Client struct. It takes an endpoint string as a parameter and returns a pointer to the Client struct.
type LogtoClientParams ¶
type LogtoClientParams struct {
URL, AppID, AppSecret, APIResource, Key string
TokenCache repository.Repository
}
type NoopClient ¶
type NoopClient struct{}
NoopClient is a stub LogtoClient registered in place of the real Logto management client when the graphql-server runs with --auth-enabled=false. It satisfies the LogtoClient interface so that the registry and resolvers need no conditional logic; calls simply fail with ErrAuthDisabled.
func (NoopClient) AccessToken ¶
func (NoopClient) AccessToken() (*AccessTokenResp, error)
func (NoopClient) AddCustomUserInformation ¶
func (NoopClient) AddCustomUserInformation( string, string, *APIUsersPatchCustomData, ) error
func (NoopClient) CheckUserWithUserName ¶
func (NoopClient) CheckUserWithUserName(string) (bool, string, error)
func (NoopClient) CreateUser ¶
func (NoopClient) CreateUser(string, *APIUsersPostReq) (string, error)
func (NoopClient) Permissions ¶
func (NoopClient) Permissions(string) ([]*PermissionResp, error)
func (NoopClient) UserWithEmail ¶
func (NoopClient) UserWithEmail(string) (*UserResp, error)
type PermissionResp ¶
type PermissionResp struct {
TenantID string `json:"tenantId"`
ID string `json:"id"`
ResourceID string `json:"resourceId"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt time.Time `json:"createdAt"`
Resource struct {
TenantID string `json:"tenantId"`
ID string `json:"id"`
Name string `json:"name"`
Indicator string `json:"indicator"`
IsDefault bool `json:"isDefault"`
AccessTokenTTL int `json:"accessTokenTtl"`
} `json:"resource"`
}
type UserResp ¶
type UserResp struct {
ID string `json:"id"`
Username string `json:"username"`
PrimaryEmail string `json:"primaryEmail"`
PrimaryPhone string `json:"primaryPhone"`
Name string `json:"name"`
Avatar any `json:"avatar,omitempty"`
CustomData struct {
City string `json:"city,omitempty"`
Phone string `json:"phone,omitempty"`
State string `json:"state,omitempty"`
Region string `json:"region,omitempty"`
Address string `json:"address,omitempty"`
Country string `json:"country,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
JobTitle string `json:"job_title,omitempty"`
Profession string `json:"profession,omitempty"`
Subscribed bool `json:"subscribed,omitempty"`
Institution string `json:"institution,omitempty"`
ResearchInterest string `json:"research_interest,omitempty"`
SecondaryAddress string `json:"secondary_address,omitempty"`
} `json:"customData"`
Identities struct{} `json:"identities"`
CreatedAt CustomTime `json:"createdAt"`
ApplicationID any `json:"applicationId,omitempty"`
IsSuspended bool `json:"isSuspended,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.