Documentation ¶
Index ¶
- Constants
- func AddResource(resource models.Resource) (models.Resource, error)
- func AddResourceToUser(user models.User, resource models.Resource, operation string) (models.Permission, error)
- func CreateUser(user models.User) error
- func DeletePermission(permission models.Permission) (models.Permission, error)
- func DeleteResource(resource models.Resource) (models.Resource, error)
- func GetDefaultLogin() (models.Login, error)
- func GetEnvVariable(key string) string
- func GetGoogleUserAPI() string
- func GetLoginByID(id int64) (models.Login, error)
- func GetOauthStateString() string
- func GetPermission(user models.User, resource models.Resource, operation string) (models.Permission, error)
- func GetPermissionsByUser(user models.User) ([]models.Permission, error)
- func GetPersistedConfig(name string) (models.Configuration, error)
- func GetPortBase() string
- func GetResourceByID(id string) (models.Resource, error)
- func GetServerAddress() string
- func GetServerBase() string
- func GetToken(token models.UserToken) (models.UserToken, error)
- func GoogleUserByToken(token oauth2.Token) (models.User, error)
- func Insert(loginID models.Login) (models.Login, error)
- func IsAuthorized(user models.User, resource models.Resource, operation string) bool
- func OauthAuthenticationTokenByType(auth string, state string, code string) (*oauth2.Token, error)
- func OauthAuthenticationURLByType(auth string) string
- func Update(login models.Login) (models.Login, error)
- func UpdatePermission(permission models.Permission) (models.Permission, error)
- func UpdatePersistedConfig(config models.Configuration) error
- func UpdateResource(resource models.Resource) (models.Resource, error)
- func UpdateToken(token models.UserToken) error
Constants ¶
const ( // Prefix Env variable used by micro service should all be prefixed Prefix = "CIDM" //UserInfoAPI Google API UserInfoAPI = "https://www.googleapis.com/oauth2/v2/userinfo?access_token=" )
const ( //OauthType constant definition OauthType = "OAUTH2" //OauthGoogle constant definition for Oauth 2 google service OauthGoogle = "OAUTH2-GOOGLE" )
Variables ¶
This section is empty.
Functions ¶
func AddResource ¶
AddResource to the global data base
func AddResourceToUser ¶
func AddResourceToUser(user models.User, resource models.Resource, operation string) (models.Permission, error)
AddResourceToUser add resource to a particular User.
func DeletePermission ¶
func DeletePermission(permission models.Permission) (models.Permission, error)
DeletePermission an existing permission for a particular user.
func DeleteResource ¶
DeleteResource in the data base.
func GetDefaultLogin ¶
GetDefaultLogin Returns the system default login for an specific running instance
func GetEnvVariable ¶
GetEnvVariable get enviroment variable from OS/ host system only variables prefixed with persitence . Prefix will be returned
func GetLoginByID ¶
GetLoginByID get login details by Id
func GetOauthStateString ¶
func GetOauthStateString() string
GetOauthStateString get state string for oauth connection
func GetPermission ¶
func GetPermission(user models.User, resource models.Resource, operation string) (models.Permission, error)
GetPermission critical function
func GetPermissionsByUser ¶
func GetPermissionsByUser(user models.User) ([]models.Permission, error)
GetPermissionsByUser get permission given a particular user.
func GetPersistedConfig ¶
func GetPersistedConfig(name string) (models.Configuration, error)
GetPersistedConfig Returns a persisted configuration in the data base from configurations
func GetPortBase ¶
func GetPortBase() string
GetPortBase Returns the current port base for the particular server.
func GetResourceByID ¶
GetResourceByID get resource by its Id that could be represented as a canonical uri.
func GoogleUserByToken ¶
GoogleUserByToken this procedure will take a valid token Id and return a user from Google userinfo API
func IsAuthorized ¶
IsAuthorized backbone function to check authorization.
func OauthAuthenticationTokenByType ¶
OauthAuthenticationTokenByType get a token based on the type of authentication defined , this will connect with external parties.
func OauthAuthenticationURLByType ¶
OauthAuthenticationURLByType returns the login authentication for an specific OAuth 2 service
func UpdatePermission ¶
func UpdatePermission(permission models.Permission) (models.Permission, error)
UpdatePermission update an existin permission for a particular user.
func UpdatePersistedConfig ¶
func UpdatePersistedConfig(config models.Configuration) error
UpdatePersistedConfig updates a persisted configuration value
func UpdateResource ¶
UpdateResource in the DB
func UpdateToken ¶
UpdateToken existing token associated with a particular user
Types ¶
This section is empty.