Documentation ¶
Index ¶
- Constants
- type Auth
- type AuthClaims
- type AuthService
- type AuthToken
- type ConfiguredPlatforms
- type CookieService
- type Credentials
- type Health
- type HealthService
- type Invite
- type InviteRepository
- type InviteRequest
- type InviteService
- type Meeting
- type MeetingDuration
- type MeetingPlatform
- type MeetingPlatformActions
- type MeetingPlatformOAuthInfo
- type MeetingPlatformRepository
- type MeetingPlatformService
- type OAuthInfo
- type OAuthInfoRepository
- type OAuthInfoService
- type Page
- type PageRequest
- type Password
- type RefreshClaims
- type RefreshToken
- type RefreshTokenRepository
- type RefreshTokenService
- type SchemaMigration
- type SchemaMigrationRepo
- type TokenExistsError
- type TokenSet
- type TokenValue
- type User
- type UserRepository
- type UserService
Constants ¶
const ( TypeInstant = 1 TypeScheduled = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
Credentials *Credentials
}
Auth contains the credentials needed to begin the authentication process.
type AuthClaims ¶
type AuthClaims struct { jwt.StandardClaims UserID uint `json:"user_id"` Usage string `json:"usage"` }
AuthClaims are the claims that are part of an AuthToken.
type AuthService ¶
type AuthService interface { IsAuthenticated(token TokenValue) (bool, error) Authenticate(auth Auth) (*TokenSet, error) RefreshToken(token TokenValue) (*TokenSet, error) Deauthenticate(token TokenValue) error GetUserFromAuthToken(token TokenValue) (*User, error) }
AuthService manages authentication based on Auths and Tokens.
type AuthToken ¶
type AuthToken struct { Value TokenValue Expires time.Time JWTClaims AuthClaims }
AuthToken represents a JWT used for authentication.
type ConfiguredPlatforms ¶
type ConfiguredPlatforms []*MeetingPlatform
ConfiguredPlatforms are a slice of MeetingPlatforms that are configured for the application.
type CookieService ¶
type CookieService interface {
SetCookie(g *gin.Context, name string, value string, maxAge int, path string, httpOnly bool)
}
CookieService manages operations on HTTP cookies.
type Credentials ¶
Credentials represents a username and password combination.
type HealthService ¶
HealthService manages retrieving the health status of the application.
type InviteRepository ¶
type InviteRequest ¶
type InviteService ¶
type InviteService interface { SendInvite(invite *InviteRequest) (uint, error) GetAllReceivedInvites(userID uint) ([]*Invite, error) GetAllSentInvites(userID uint) ([]*Invite, error) GetInvite(inviteID uint) (*Invite, error) DeleteInvite(inviteID uint) error DeleteAllInvitesByMeetingID(meetingID string) error }
type Meeting ¶
type Meeting struct { ID string Title string StartTime time.Time Duration time.Duration Description string JoinURL string StartURL string Type int }
Meeting represents a meeting on a MeetingPlatform.
type MeetingDuration ¶
func (*MeetingDuration) Scan ¶
func (m *MeetingDuration) Scan(src interface{}) error
type MeetingPlatform ¶
type MeetingPlatform struct { gorm.Model Name string OAuth MeetingPlatformOAuthInfo `gorm:"-"` Actions MeetingPlatformActions `gorm:"-"` }
MeetingPlatform represents an external MeetingPlatform.
type MeetingPlatformActions ¶
type MeetingPlatformActions interface { CreateMeeting(oauth OAuthInfo, meeting *Meeting) (*Meeting, error) GetMeetings(oauth OAuthInfo, pageReq PageRequest) (*Page, error) GetMeeting(oauth OAuthInfo, meetingID string) (*Meeting, error) DeleteMeeting(oauth OAuthInfo, meetingID string) error }
MeetingPlatformActions are implementations of the MeetingPlatform's API.
type MeetingPlatformOAuthInfo ¶
MeetingPlatformOAuthInfo contains configuration information about the MeetingPlatform's OAuth implementation.
type MeetingPlatformRepository ¶
type MeetingPlatformRepository interface { Create(platform *MeetingPlatform) (uint, error) GetAll() ([]*MeetingPlatform, error) GetByID(ID uint) (*MeetingPlatform, error) GetByPlatformName(name string) (*MeetingPlatform, error) Update(platform *MeetingPlatform) error Delete(ID uint) error }
MeetingPlatformRepository stores information about MeetingPlatforms.
type MeetingPlatformService ¶
type MeetingPlatformService interface { Save(platform *MeetingPlatform) (uint, error) GetAll() ([]*MeetingPlatform, error) Delete(ID uint) error GetByID(ID uint) (*MeetingPlatform, error) GetByPlatformName(name string) (*MeetingPlatform, error) GetOAuthToken(ctx context.Context, authorization string, platform *MeetingPlatform) (*oauth2.Token, error) RefreshOAuthToken(ctx context.Context, token *oauth2.Token, platform *MeetingPlatform) (*oauth2.Token, error) }
MeetingPlatformServices manages CRUD operations on a MeetingPlatform as well as OAuth.
type OAuthInfo ¶
type OAuthInfo struct { gorm.Model UserID uint MeetingPlatformID uint AccessToken string RefreshToken string TokenType string Expiry time.Time }
OAuthInfo represents OAuth token information.
type OAuthInfoRepository ¶
type OAuthInfoRepository interface { Create(oauthToken *OAuthInfo) (uint, error) GetAll() ([]*OAuthInfo, error) GetByID(ID uint) (*OAuthInfo, error) GetAllByMeetingPlatformID(ID uint) ([]*OAuthInfo, error) GetAllByUserID(userID uint) ([]*OAuthInfo, error) GetByUserIDAndMeetingPlatformID(userID uint, meetingPlatformID uint) (*OAuthInfo, error) Update(oauthToken *OAuthInfo) error Delete(ID uint) error }
OAuthInfoRepository manages storing and retrieving OAuthInfos.
type OAuthInfoService ¶
type OAuthInfoService interface { CreateOAuthInfo(ctx context.Context, authorization string, userID uint, platform *MeetingPlatform) error GetOAuthInfo(userID uint, platform *MeetingPlatform) (*OAuthInfo, error) GetAllAuthenticatedPlatforms(userID uint) ([]*MeetingPlatform, error) }
OAuthInfoService manages the creation and retrieval of OAuthInfos for a User.
type Page ¶
type Page struct { PageCount int PageNumber int PageSize int TotalRecords int NextPageToken string PreviousPageToken string Records []interface{} }
Page represents a paginated response.
type PageRequest ¶
PageRequest represents a paginated request.
type Password ¶
type Password struct { Hash []byte // contains filtered or unexported fields }
Password represents both a plaintext and hased password.
func NewPassword ¶
NewPassword creates a new Password based on the plaintext given.
func (*Password) HashPassword ¶
HashPassword hashes and salts the password.
type RefreshClaims ¶
type RefreshClaims struct { jwt.StandardClaims UserID uint `json:"user_id"` AuthTokenHash string `json:"auth_token_hash"` ParentTokenHash string `json:"parent_token_hash"` Nonce string `json:"nonce"` Usage string `json:"usage"` }
RefreshClaims are the claims that are part of a RefreshToken.
type RefreshToken ¶
type RefreshToken struct { gorm.Model Value TokenValue `gorm:"column:token_hash"` ExpiresAt time.Time TokenNonceHash string ParentTokenHash string UserID uint Revoked bool JWTClaims RefreshClaims `gorm:"-"` }
RefreshToken represents a JWT used for refreshing AuthTokens.
func (RefreshToken) Hash ¶
func (r RefreshToken) Hash() string
Hash returns the hash of the RefreshToken's Value.
type RefreshTokenRepository ¶
type RefreshTokenRepository interface { Create(token RefreshToken) (uint, error) GetAll() ([]*RefreshToken, error) GetByToken(token RefreshToken) (*RefreshToken, error) GetByTokenNonceHash(nonceHash string) (*RefreshToken, error) Update(token *RefreshToken) error Delete(ID uint) error }
RefreshTokenRepository stores information about RefreshTokens.
type RefreshTokenService ¶
type RefreshTokenService interface { SaveNewRefreshToken(token RefreshToken) (uint, error) ReplaceRefreshToken(token RefreshToken) error GetLatestTokenInSession(token RefreshToken) (*RefreshToken, error) RevokeLatestRefreshTokenByNonce(token RefreshToken) error }
RefreshTokenService manages operations on RefreshTokens.
type SchemaMigration ¶
SchemaMigration represents the data provided by the go migrate tool.
type SchemaMigrationRepo ¶
type SchemaMigrationRepo interface { GetSchemaMigrationByVersion(version int) (*SchemaMigration, error) GetSchemaMigration() (*SchemaMigration, error) }
SchemaMigrationRepo stores information about SchemaMigrations.
type TokenExistsError ¶
TokenExistsError is an error that occurs when an OAuthInfo already exists for a User and MeetingPlatform combination, but a new OAuthInfo is trying to be created.
func (TokenExistsError) Error ¶
func (t TokenExistsError) Error() string
type TokenSet ¶
type TokenSet struct { Auth AuthToken Refresh RefreshToken }
TokenSet is a set containing an AuthToken and RefreshToken.
type TokenValue ¶
type TokenValue string
func (*TokenValue) Scan ¶
func (r *TokenValue) Scan(src interface{}) error
type UserRepository ¶
type UserRepository interface { Create(user *User) (uint, error) GetAll() ([]*User, error) GetByID(ID uint) (*User, error) GetByUsername(username string) (*User, error) Update(user *User) error Delete(ID uint) error }
UserRepository manages storing and retrieving information about a User.
type UserService ¶
type UserService interface { Register(user *User) (uint, error) Validate(credentials *Credentials) (*User, error) GetAll() ([]*User, error) GetByID(ID uint) (*User, error) GetByUsername(username string) (*User, error) Update(user *User) error Delete(ID uint) error }
UserService manages processing information about a User.