Documentation ¶
Overview ¶
Package acctauth provides an authentication layer for mservice methods.
Index ¶
- func GetInt64FromClaims(claims *map[string]interface{}, key string) int64
- func GetStringFromClaims(claims *map[string]interface{}, key string) string
- type AccountAuth
- func (s *AccountAuth) AddClaimToRole(ctx context.Context, req *pb.AddClaimToRoleRequest) (*pb.AddClaimToRoleResponse, error)
- func (s *AccountAuth) AddUserToRole(ctx context.Context, req *pb.AddUserToRoleRequest) (*pb.AddUserToRoleResponse, error)
- func (s *AccountAuth) CreateAccount(ctx context.Context, req *pb.CreateAccountRequest) (*pb.CreateAccountResponse, error)
- func (s *AccountAuth) CreateAccountRole(ctx context.Context, req *pb.CreateAccountRoleRequest) (*pb.CreateAccountRoleResponse, error)
- func (s *AccountAuth) CreateAccountUser(ctx context.Context, req *pb.CreateAccountUserRequest) (*pb.CreateAccountUserResponse, error)
- func (s *AccountAuth) CreateClaimName(ctx context.Context, req *pb.CreateClaimNameRequest) (*pb.CreateClaimNameResponse, error)
- func (s *AccountAuth) CreateClaimValue(ctx context.Context, req *pb.CreateClaimValueRequest) (*pb.CreateClaimValueResponse, error)
- func (s *AccountAuth) DeleteAccount(ctx context.Context, req *pb.DeleteAccountRequest) (*pb.DeleteAccountResponse, error)
- func (s *AccountAuth) DeleteAccountRole(ctx context.Context, req *pb.DeleteAccountRoleRequest) (*pb.DeleteAccountRoleResponse, error)
- func (s *AccountAuth) DeleteAccountUser(ctx context.Context, req *pb.DeleteAccountUserRequest) (*pb.DeleteAccountUserResponse, error)
- func (s *AccountAuth) DeleteClaimName(ctx context.Context, req *pb.DeleteClaimNameRequest) (*pb.DeleteClaimNameResponse, error)
- func (s *AccountAuth) DeleteClaimValue(ctx context.Context, req *pb.DeleteClaimValueRequest) (*pb.DeleteClaimValueResponse, error)
- func (s *AccountAuth) GetAccountById(ctx context.Context, req *pb.GetAccountByIdRequest) (*pb.GetAccountByIdResponse, error)
- func (s *AccountAuth) GetAccountByName(ctx context.Context, req *pb.GetAccountByNameRequest) (*pb.GetAccountByNameResponse, error)
- func (s *AccountAuth) GetAccountNames(ctx context.Context, req *pb.GetAccountNamesRequest) (*pb.GetAccountNamesResponse, error)
- func (s *AccountAuth) GetAccountRoleById(ctx context.Context, req *pb.GetAccountRoleByIdRequest) (*pb.GetAccountRoleByIdResponse, error)
- func (s *AccountAuth) GetAccountRoles(ctx context.Context, req *pb.GetAccountRolesRequest) (*pb.GetAccountRolesResponse, error)
- func (s *AccountAuth) GetAccountUserByEmail(ctx context.Context, req *pb.GetAccountUserByEmailRequest) (*pb.GetAccountUserByEmailResponse, error)
- func (s *AccountAuth) GetAccountUserById(ctx context.Context, req *pb.GetAccountUserByIdRequest) (*pb.GetAccountUserByIdResponse, error)
- func (s *AccountAuth) GetAccountUsers(ctx context.Context, req *pb.GetAccountUsersRequest) (*pb.GetAccountUsersResponse, error)
- func (s *AccountAuth) GetClaimNameById(ctx context.Context, req *pb.GetClaimNameByIdRequest) (*pb.GetClaimNameByIdResponse, error)
- func (s *AccountAuth) GetClaimNames(ctx context.Context, req *pb.GetClaimNamesRequest) (*pb.GetClaimNamesResponse, error)
- func (s *AccountAuth) GetClaimValueById(ctx context.Context, req *pb.GetClaimValueByIdRequest) (*pb.GetClaimValueByIdResponse, error)
- func (s *AccountAuth) GetClaimValues(ctx context.Context, req *pb.GetClaimValuesRequest) (*pb.GetClaimValuesResponse, error)
- func (s *AccountAuth) GetClaimValuesByNameId(ctx context.Context, req *pb.GetClaimValuesByNameIdRequest) (*pb.GetClaimValuesByNameIdResponse, error)
- func (s *AccountAuth) GetJwtFromContext(ctx context.Context) (*map[string]interface{}, error)
- func (s *AccountAuth) GetServerVersion(ctx context.Context, req *pb.GetServerVersionRequest) (*pb.GetServerVersionResponse, error)
- func (s *AccountAuth) HelperAccountIdFromRoleId(roleId int64) (int64, error)
- func (s *AccountAuth) HelperAccountIdFromUserid(userId int64) (int64, error)
- func (s *AccountAuth) HelperClaimFromClaimValueId(claimValueId int64) (string, string, error)
- func (s *AccountAuth) HelperRoleContains(roleId int64, claimName string, claimValue string) bool
- func (s *AccountAuth) Login(ctx context.Context, req *pb.LoginRequest) (*pb.LoginResponse, error)
- func (s *AccountAuth) NewApiServer(gServer *grpc.Server) error
- func (s *AccountAuth) RemoveClaimFromRole(ctx context.Context, req *pb.RemoveClaimFromRoleRequest) (*pb.RemoveClaimFromRoleResponse, error)
- func (s *AccountAuth) RemoveUserFromRole(ctx context.Context, req *pb.RemoveUserFromRoleRequest) (*pb.RemoveUserFromRoleResponse, error)
- func (s *AccountAuth) ResetAccountUserPassword(ctx context.Context, req *pb.ResetAccountUserPasswordRequest) (*pb.ResetAccountUserPasswordResponse, error)
- func (s *AccountAuth) SetDatabaseConnection(sqlDB *sql.DB)
- func (s *AccountAuth) SetLogger(logger log.Logger)
- func (s *AccountAuth) SetPublicKey(publicKeyFile string) error
- func (s *AccountAuth) UpdateAccount(ctx context.Context, req *pb.UpdateAccountRequest) (*pb.UpdateAccountResponse, error)
- func (s *AccountAuth) UpdateAccountRole(ctx context.Context, req *pb.UpdateAccountRoleRequest) (*pb.UpdateAccountRoleResponse, error)
- func (s *AccountAuth) UpdateAccountUser(ctx context.Context, req *pb.UpdateAccountUserRequest) (*pb.UpdateAccountUserResponse, error)
- func (s *AccountAuth) UpdateAccountUserPassword(ctx context.Context, req *pb.UpdateAccountUserPasswordRequest) (*pb.UpdateAccountUserPasswordResponse, error)
- func (s *AccountAuth) UpdateClaimName(ctx context.Context, req *pb.UpdateClaimNameRequest) (*pb.UpdateClaimNameResponse, error)
- func (s *AccountAuth) UpdateClaimValue(ctx context.Context, req *pb.UpdateClaimValueRequest) (*pb.UpdateClaimValueResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetInt64FromClaims ¶
Get an int64 value from JWT claims based on key.
func GetStringFromClaims ¶
Get an string value from JWT claims based on key.
Types ¶
type AccountAuth ¶ added in v0.9.2
type AccountAuth struct { pb.UnimplementedMServiceAccountServer // contains filtered or unexported fields }
Message receiver for account authorization.
func NewAccountAuth ¶
func NewAccountAuth(acctService pb.MServiceAccountServer) *AccountAuth
Create a new message receiver for account authorization.
func (*AccountAuth) AddClaimToRole ¶ added in v0.9.2
func (s *AccountAuth) AddClaimToRole(ctx context.Context, req *pb.AddClaimToRoleRequest) (*pb.AddClaimToRoleResponse, error)
associate a claim with an account role.
func (*AccountAuth) AddUserToRole ¶ added in v0.9.2
func (s *AccountAuth) AddUserToRole(ctx context.Context, req *pb.AddUserToRoleRequest) (*pb.AddUserToRoleResponse, error)
associate an account user with an account role.
func (*AccountAuth) CreateAccount ¶ added in v0.9.2
func (s *AccountAuth) CreateAccount(ctx context.Context, req *pb.CreateAccountRequest) (*pb.CreateAccountResponse, error)
create a new account
func (*AccountAuth) CreateAccountRole ¶ added in v0.9.2
func (s *AccountAuth) CreateAccountRole(ctx context.Context, req *pb.CreateAccountRoleRequest) (*pb.CreateAccountRoleResponse, error)
create account role.
func (*AccountAuth) CreateAccountUser ¶ added in v0.9.2
func (s *AccountAuth) CreateAccountUser(ctx context.Context, req *pb.CreateAccountUserRequest) (*pb.CreateAccountUserResponse, error)
create an account user.
func (*AccountAuth) CreateClaimName ¶ added in v0.9.2
func (s *AccountAuth) CreateClaimName(ctx context.Context, req *pb.CreateClaimNameRequest) (*pb.CreateClaimNameResponse, error)
create a claim name.
func (*AccountAuth) CreateClaimValue ¶ added in v0.9.2
func (s *AccountAuth) CreateClaimValue(ctx context.Context, req *pb.CreateClaimValueRequest) (*pb.CreateClaimValueResponse, error)
create claim value.
func (*AccountAuth) DeleteAccount ¶ added in v0.9.2
func (s *AccountAuth) DeleteAccount(ctx context.Context, req *pb.DeleteAccountRequest) (*pb.DeleteAccountResponse, error)
delete an existing account.
func (*AccountAuth) DeleteAccountRole ¶ added in v0.9.2
func (s *AccountAuth) DeleteAccountRole(ctx context.Context, req *pb.DeleteAccountRoleRequest) (*pb.DeleteAccountRoleResponse, error)
delete existing account role.
func (*AccountAuth) DeleteAccountUser ¶ added in v0.9.2
func (s *AccountAuth) DeleteAccountUser(ctx context.Context, req *pb.DeleteAccountUserRequest) (*pb.DeleteAccountUserResponse, error)
delete an existing account user.
func (*AccountAuth) DeleteClaimName ¶ added in v0.9.2
func (s *AccountAuth) DeleteClaimName(ctx context.Context, req *pb.DeleteClaimNameRequest) (*pb.DeleteClaimNameResponse, error)
delete an existing claim name.
func (*AccountAuth) DeleteClaimValue ¶ added in v0.9.2
func (s *AccountAuth) DeleteClaimValue(ctx context.Context, req *pb.DeleteClaimValueRequest) (*pb.DeleteClaimValueResponse, error)
delete existing claim value.
func (*AccountAuth) GetAccountById ¶ added in v0.9.2
func (s *AccountAuth) GetAccountById(ctx context.Context, req *pb.GetAccountByIdRequest) (*pb.GetAccountByIdResponse, error)
get an account by account id.
func (*AccountAuth) GetAccountByName ¶ added in v0.9.2
func (s *AccountAuth) GetAccountByName(ctx context.Context, req *pb.GetAccountByNameRequest) (*pb.GetAccountByNameResponse, error)
get an account by account name.
func (*AccountAuth) GetAccountNames ¶ added in v0.9.2
func (s *AccountAuth) GetAccountNames(ctx context.Context, req *pb.GetAccountNamesRequest) (*pb.GetAccountNamesResponse, error)
Get account names within account.
func (*AccountAuth) GetAccountRoleById ¶ added in v0.9.2
func (s *AccountAuth) GetAccountRoleById(ctx context.Context, req *pb.GetAccountRoleByIdRequest) (*pb.GetAccountRoleByIdResponse, error)
get account role by id.
func (*AccountAuth) GetAccountRoles ¶ added in v0.9.2
func (s *AccountAuth) GetAccountRoles(ctx context.Context, req *pb.GetAccountRolesRequest) (*pb.GetAccountRolesResponse, error)
get all account roles in account.
func (*AccountAuth) GetAccountUserByEmail ¶ added in v0.9.2
func (s *AccountAuth) GetAccountUserByEmail(ctx context.Context, req *pb.GetAccountUserByEmailRequest) (*pb.GetAccountUserByEmailResponse, error)
get an account user by email.
func (*AccountAuth) GetAccountUserById ¶ added in v0.9.2
func (s *AccountAuth) GetAccountUserById(ctx context.Context, req *pb.GetAccountUserByIdRequest) (*pb.GetAccountUserByIdResponse, error)
get an account user by id.
func (*AccountAuth) GetAccountUsers ¶ added in v0.9.2
func (s *AccountAuth) GetAccountUsers(ctx context.Context, req *pb.GetAccountUsersRequest) (*pb.GetAccountUsersResponse, error)
get all account users in account.
func (*AccountAuth) GetClaimNameById ¶ added in v0.9.5
func (s *AccountAuth) GetClaimNameById(ctx context.Context, req *pb.GetClaimNameByIdRequest) (*pb.GetClaimNameByIdResponse, error)
func (*AccountAuth) GetClaimNames ¶ added in v0.9.2
func (s *AccountAuth) GetClaimNames(ctx context.Context, req *pb.GetClaimNamesRequest) (*pb.GetClaimNamesResponse, error)
get all claim names.
func (*AccountAuth) GetClaimValueById ¶ added in v0.9.2
func (s *AccountAuth) GetClaimValueById(ctx context.Context, req *pb.GetClaimValueByIdRequest) (*pb.GetClaimValueByIdResponse, error)
get claim value by id.
func (*AccountAuth) GetClaimValues ¶ added in v0.9.2
func (s *AccountAuth) GetClaimValues(ctx context.Context, req *pb.GetClaimValuesRequest) (*pb.GetClaimValuesResponse, error)
get all claim values for all claim names.
func (*AccountAuth) GetClaimValuesByNameId ¶ added in v0.9.2
func (s *AccountAuth) GetClaimValuesByNameId(ctx context.Context, req *pb.GetClaimValuesByNameIdRequest) (*pb.GetClaimValuesByNameIdResponse, error)
get all claim values for name id.
func (*AccountAuth) GetJwtFromContext ¶ added in v0.9.2
func (s *AccountAuth) GetJwtFromContext(ctx context.Context) (*map[string]interface{}, error)
Get the Javascript Web Token (JWT) from GRPC context.
func (*AccountAuth) GetServerVersion ¶ added in v0.9.2
func (s *AccountAuth) GetServerVersion(ctx context.Context, req *pb.GetServerVersionRequest) (*pb.GetServerVersionResponse, error)
get current server version and uptime - health check
func (*AccountAuth) HelperAccountIdFromRoleId ¶ added in v0.9.2
func (s *AccountAuth) HelperAccountIdFromRoleId(roleId int64) (int64, error)
Helper to get account id from role id.
func (*AccountAuth) HelperAccountIdFromUserid ¶ added in v0.9.2
func (s *AccountAuth) HelperAccountIdFromUserid(userId int64) (int64, error)
Helper to get account id from user id.
func (*AccountAuth) HelperClaimFromClaimValueId ¶ added in v0.9.2
func (s *AccountAuth) HelperClaimFromClaimValueId(claimValueId int64) (string, string, error)
Helper to get the claim name and claim value from claim value id
func (*AccountAuth) HelperRoleContains ¶ added in v0.9.2
func (s *AccountAuth) HelperRoleContains(roleId int64, claimName string, claimValue string) bool
func (*AccountAuth) Login ¶ added in v0.9.2
func (s *AccountAuth) Login(ctx context.Context, req *pb.LoginRequest) (*pb.LoginResponse, error)
login does not require previous authorization.
func (*AccountAuth) NewApiServer ¶ added in v0.9.2
func (s *AccountAuth) NewApiServer(gServer *grpc.Server) error
Bind account authorization to GRPC server.
func (*AccountAuth) RemoveClaimFromRole ¶ added in v0.9.2
func (s *AccountAuth) RemoveClaimFromRole(ctx context.Context, req *pb.RemoveClaimFromRoleRequest) (*pb.RemoveClaimFromRoleResponse, error)
remove a claim from an account role.
func (*AccountAuth) RemoveUserFromRole ¶ added in v0.9.2
func (s *AccountAuth) RemoveUserFromRole(ctx context.Context, req *pb.RemoveUserFromRoleRequest) (*pb.RemoveUserFromRoleResponse, error)
disassociate an account user from an account role.
func (*AccountAuth) ResetAccountUserPassword ¶ added in v0.9.5
func (s *AccountAuth) ResetAccountUserPassword(ctx context.Context, req *pb.ResetAccountUserPasswordRequest) (*pb.ResetAccountUserPasswordResponse, error)
reset an existing account user password without knowing old password
func (*AccountAuth) SetDatabaseConnection ¶ added in v0.9.2
func (s *AccountAuth) SetDatabaseConnection(sqlDB *sql.DB)
Set the database connection for account authorization.
func (*AccountAuth) SetLogger ¶ added in v0.9.2
func (s *AccountAuth) SetLogger(logger log.Logger)
Set the logger for account authorization.
func (*AccountAuth) SetPublicKey ¶ added in v0.9.2
func (s *AccountAuth) SetPublicKey(publicKeyFile string) error
Set the RSA public key for JWT validation.
func (*AccountAuth) UpdateAccount ¶ added in v0.9.2
func (s *AccountAuth) UpdateAccount(ctx context.Context, req *pb.UpdateAccountRequest) (*pb.UpdateAccountResponse, error)
update an existing account.
func (*AccountAuth) UpdateAccountRole ¶ added in v0.9.2
func (s *AccountAuth) UpdateAccountRole(ctx context.Context, req *pb.UpdateAccountRoleRequest) (*pb.UpdateAccountRoleResponse, error)
update existing account role.
func (*AccountAuth) UpdateAccountUser ¶ added in v0.9.2
func (s *AccountAuth) UpdateAccountUser(ctx context.Context, req *pb.UpdateAccountUserRequest) (*pb.UpdateAccountUserResponse, error)
update an existing account user.
func (*AccountAuth) UpdateAccountUserPassword ¶ added in v0.9.2
func (s *AccountAuth) UpdateAccountUserPassword(ctx context.Context, req *pb.UpdateAccountUserPasswordRequest) (*pb.UpdateAccountUserPasswordResponse, error)
update an existing account user password.
func (*AccountAuth) UpdateClaimName ¶ added in v0.9.2
func (s *AccountAuth) UpdateClaimName(ctx context.Context, req *pb.UpdateClaimNameRequest) (*pb.UpdateClaimNameResponse, error)
update an existing claim name.
func (*AccountAuth) UpdateClaimValue ¶ added in v0.9.2
func (s *AccountAuth) UpdateClaimValue(ctx context.Context, req *pb.UpdateClaimValueRequest) (*pb.UpdateClaimValueResponse, error)
update existing claim value.