Documentation
¶
Index ¶
- Constants
- func ConvertUser(u *User) *types2.User
- func EmailClaimByType(t string) string
- func JWKSURLByType(t string) string
- func MergeOAuthAppManifests(r, other types.OAuthAppManifest) types.OAuthAppManifest
- func OAuthURLByType(t string) string
- func ScopesByType(t string) string
- func TokenURLByType(t string) string
- func UsernameClaimByType(t string) string
- func ValidateAndSetDefaultsOAuthAppManifest(r *types.OAuthAppManifest, create bool) error
- type AuthProvider
- type AuthToken
- type AuthTypeConfig
- type GoogleOAuthTokenResponse
- type Identity
- type LLMProvider
- type LLMProxyActivity
- type Model
- type OAuthAppTypeConfig
- type OAuthTokenRequestChallenge
- type OAuthTokenResponse
- type SlackOAuthTokenResponse
- type TokenRequest
- type User
- type UserQuery
Constants ¶
View Source
const ( AtlassianAuthorizeURL = "https://auth.atlassian.com/authorize" AtlassianTokenURL = "https://auth.atlassian.com/oauth/token" SlackAuthorizeURL = "https://slack.com/oauth/v2/authorize" SlackTokenURL = "https://slack.com/api/oauth.v2.access" NotionAuthorizeURL = "https://api.notion.com/v1/oauth/authorize" NotionTokenURL = "https://api.notion.com/v1/oauth/token" HubSpotAuthorizeURL = "https://app.hubspot.com/oauth/authorize" HubSpotTokenURL = "https://api.hubapi.com/oauth/v1/token" GoogleAuthorizeURL = "https://accounts.google.com/o/oauth2/v2/auth" GoogleTokenURL = "https://oauth2.googleapis.com/token" GitHubAuthorizeURL = "https://github.com/login/oauth/authorize" )
View Source
const ( GitHubOAuthURL = "https://github.com/login/oauth/authorize" GitHubTokenURL = "https://github.com/login/oauth/access_token" GoogleOAuthURL = "https://accounts.google.com/o/oauth2/auth" GoogleJWKSURL = "https://www.googleapis.com/oauth2/v3/certs" AzureOauthURL = "https://login.microsoftonline.com/{tenantID}/oauth2/v2.0/authorize" AzureJWKSURL = "https://login.microsoftonline.com/{tenantID}/discovery/v2.0/keys" AuthTypeGitHub = "github" AuthTypeAzureAD = "azuread" AuthTypeGoogle = "google" AuthTypeGenericOIDC = "genericOIDC" )
Variables ¶
This section is empty.
Functions ¶
func ConvertUser ¶
func EmailClaimByType ¶
func JWKSURLByType ¶
func MergeOAuthAppManifests ¶
func MergeOAuthAppManifests(r, other types.OAuthAppManifest) types.OAuthAppManifest
func OAuthURLByType ¶
func ScopesByType ¶
func TokenURLByType ¶
func UsernameClaimByType ¶
func ValidateAndSetDefaultsOAuthAppManifest ¶
func ValidateAndSetDefaultsOAuthAppManifest(r *types.OAuthAppManifest, create bool) error
Types ¶
type AuthProvider ¶
type AuthProvider struct {
// These fields are set for every auth provider
gorm.Model `json:",inline"`
Type string `json:"type"`
ServiceName string `json:"serviceName"`
Slug string `json:"slug" gorm:"unique"`
ClientID string `json:"clientID"`
ClientSecret string `json:"clientSecret"`
OAuthURL string `json:"oauthURL"`
Scopes string `json:"scopes,omitempty"`
Expiration string `json:"expiration,omitempty"`
ExpirationDur time.Duration `json:"-"`
Disabled bool `json:"disabled"`
// Not needed for OIDC type flows
TokenURL string `json:"tokenURL"`
// These fields are only set for AzureAD
TenantID string `json:"tenantID,omitempty"`
// These fields are only set for OIDC providers, including AzureAD
JWKSURL string `json:"jwksURL,omitempty"`
UsernameClaim string `json:"usernameClaim,omitempty"`
EmailClaim string `json:"emailClaim,omitempty"`
}
func (*AuthProvider) AuthURL ¶
func (ap *AuthProvider) AuthURL(baseURL string, state, nonce string) string
func (*AuthProvider) RedirectURL ¶
func (ap *AuthProvider) RedirectURL(baseURL string) string
func (*AuthProvider) ValidateAndSetDefaults ¶
func (ap *AuthProvider) ValidateAndSetDefaults() error
type AuthToken ¶
type AuthToken struct {
ID string `json:"id" gorm:"index:idx_id_hashed_token"`
UserID uint `json:"-" gorm:"index"`
AuthProviderID uint `json:"-" gorm:"index"`
HashedToken string `json:"-" gorm:"index:idx_id_hashed_token"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
}
type AuthTypeConfig ¶
type Identity ¶
type Identity struct {
AuthProviderID uint `json:"authProviderID" gorm:"primaryKey;index:idx_user_auth_id"`
ProviderUsername string `json:"providerUsername" gorm:"primaryKey"`
Email string `json:"email"`
UserID uint `json:"userID" gorm:"index:idx_user_auth_id"`
IconURL string `json:"iconURL"`
IconLastChecked time.Time `json:"iconLastChecked"`
}
type LLMProvider ¶
type LLMProvider struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Name string `json:"name"`
Slug string `json:"slug" gorm:"unique;index"`
BaseURL string `json:"baseURL"`
Token string `json:"token"`
Disabled bool `json:"disabled"`
}
func (*LLMProvider) RequestBaseURL ¶
func (lp *LLMProvider) RequestBaseURL(serverBase string) string
func (*LLMProvider) URL ¶
func (lp *LLMProvider) URL() string
func (*LLMProvider) Validate ¶
func (lp *LLMProvider) Validate() error
type LLMProxyActivity ¶
type Model ¶
type Model struct {
ID string `json:"id" gorm:"unique"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
LLMProviderID uint `json:"llmProviderID" gorm:"foreignKey:id;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
ProviderModelName string `json:"providerModelName"`
Disabled bool `json:"disabled"`
}
type OAuthAppTypeConfig ¶
type OAuthTokenResponse ¶
type OAuthTokenResponse struct {
State string `json:"state"`
TokenType string `json:"token_type"`
Scope string `json:"scope"`
ExpiresIn int `json:"expires_in"`
ExtExpiresIn int `json:"ext_expires_in"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
Ok bool `json:"ok"`
Error string `json:"error"`
CreatedAt time.Time
}
OAuthTokenResponse represents a response from the /token endpoint on an OAuth server. These do not get stored in the database.
type SlackOAuthTokenResponse ¶
type TokenRequest ¶
Click to show internal directories.
Click to hide internal directories.