Documentation ¶
Index ¶
- Variables
- type Module
- func (m *Module) CreateToken(tokenClaims TokenClaims) (string, error)
- func (m *Module) GetInternalAccessToken() (string, error)
- func (m *Module) GetSCAccessToken() (string, error)
- func (m *Module) IsAggregateOpAuthorised(ctx context.Context, project, dbType, col, token string, ...) (int, error)
- func (m *Module) IsCreateOpAuthorised(ctx context.Context, project, dbType, col, token string, ...) (int, error)
- func (m *Module) IsDeleteOpAuthorised(ctx context.Context, project, dbType, col, token string, ...) (int, error)
- func (m *Module) IsFileOpAuthorised(ctx context.Context, project, token, path string, op utils.FileOpType, ...) (*PostProcess, error)
- func (m *Module) IsFuncCallAuthorised(ctx context.Context, project, service, function, token string, ...) (TokenClaims, error)
- func (m *Module) IsReadOpAuthorised(ctx context.Context, project, dbType, col, token string, ...) (*PostProcess, int, error)
- func (m *Module) IsTokenInternal(token string) error
- func (m *Module) IsUpdateOpAuthorised(ctx context.Context, project, dbType, col, token string, ...) (int, error)
- func (m *Module) PostProcessMethod(postProcess *PostProcess, result interface{}) error
- func (m *Module) SetConfig(project string, secret string, rules config.Crud, fileStore *config.FileStore, ...) error
- func (m *Module) SetMakeHttpRequest(function utils.MakeHttpRequest)
- func (m *Module) SetSecret(secret string)
- type PostProcess
- type PostProcessAction
- type TokenClaims
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidSigningMethod denotes a jwt signing method type not used by Space Cloud. ErrInvalidSigningMethod = errors.New("invalid signing method type") ErrTokenVerification = errors.New("AUTH: JWT token could not be verified") )
var ErrIncorrectMatch = errors.New("Auth: The two fields do not match")
ErrIncorrectMatch is thrown when the field type of a rule is of incorrect type
var ErrIncorrectRuleFieldType = errors.New("Auth: Incorrect rule field type")
ErrIncorrectRuleFieldType is thrown when the field type of a rule is of incorrect type
var ErrRuleNotFound = errors.New("Auth: No rule has been provided")
ErrRuleNotFound is thrown when an error is not present in the auth object
Functions ¶
This section is empty.
Types ¶
type Module ¶
Module is responsible for authentication and authorisation
func (*Module) CreateToken ¶
func (m *Module) CreateToken(tokenClaims TokenClaims) (string, error)
CreateToken generates a new JWT Token with the token claims
func (*Module) GetInternalAccessToken ¶ added in v0.12.0
GetInternalAccessToken returns the token that can be used internally by Space Cloud
func (*Module) GetSCAccessToken ¶ added in v0.15.0
GetSCAccessToken returns the token that can be used to verify Space Cloud
func (*Module) IsAggregateOpAuthorised ¶
func (m *Module) IsAggregateOpAuthorised(ctx context.Context, project, dbType, col, token string, req *model.AggregateRequest) (int, error)
IsAggregateOpAuthorised checks if the crud operation is authorised
func (*Module) IsCreateOpAuthorised ¶
func (m *Module) IsCreateOpAuthorised(ctx context.Context, project, dbType, col, token string, req *model.CreateRequest) (int, error)
IsCreateOpAuthorised checks if the crud operation is authorised
func (*Module) IsDeleteOpAuthorised ¶
func (m *Module) IsDeleteOpAuthorised(ctx context.Context, project, dbType, col, token string, req *model.DeleteRequest) (int, error)
IsDeleteOpAuthorised checks if the crud operation is authorised
func (*Module) IsFileOpAuthorised ¶
func (m *Module) IsFileOpAuthorised(ctx context.Context, project, token, path string, op utils.FileOpType, args map[string]interface{}) (*PostProcess, error)
IsFileOpAuthorised checks if the caller is authorized to make the request
func (*Module) IsFuncCallAuthorised ¶
func (m *Module) IsFuncCallAuthorised(ctx context.Context, project, service, function, token string, params interface{}) (TokenClaims, error)
IsFuncCallAuthorised checks if the func call is authorised
func (*Module) IsReadOpAuthorised ¶
func (m *Module) IsReadOpAuthorised(ctx context.Context, project, dbType, col, token string, req *model.ReadRequest) (*PostProcess, int, error)
IsReadOpAuthorised checks if the crud operation is authorised
func (*Module) IsTokenInternal ¶ added in v0.13.0
IsTokenInternal checks if the provided token is internally generated
func (*Module) IsUpdateOpAuthorised ¶
func (m *Module) IsUpdateOpAuthorised(ctx context.Context, project, dbType, col, token string, req *model.UpdateRequest) (int, error)
IsUpdateOpAuthorised checks if the crud operation is authorised
func (*Module) PostProcessMethod ¶ added in v0.15.0
func (m *Module) PostProcessMethod(postProcess *PostProcess, result interface{}) error
PostProcessMethod to do processing on result
func (*Module) SetConfig ¶
func (m *Module) SetConfig(project string, secret string, rules config.Crud, fileStore *config.FileStore, functions *config.ServicesModule) error
SetConfig set the rules and secret key required by the auth block
func (*Module) SetMakeHttpRequest ¶ added in v0.13.0
func (m *Module) SetMakeHttpRequest(function utils.MakeHttpRequest)
type PostProcess ¶ added in v0.15.0
type PostProcess struct {
// contains filtered or unexported fields
}
PostProcess is responsible for implementing force and remove rules
type PostProcessAction ¶ added in v0.15.0
PostProcessAction has action -> force/remove and field,value depending on the Action.
type TokenClaims ¶
type TokenClaims map[string]interface{}
TokenClaims holds the JWT token claims
func (TokenClaims) GetRole ¶ added in v0.10.0
func (c TokenClaims) GetRole() (string, error)
GetRole returns the role present in the token claims