Documentation ¶
Overview ¶
Package charon is a generated protocol buffer package.
It is generated from these files:
charon.proto
It has these top-level messages:
LoginRequest LoginResponse LogoutRequest LogoutResponse IsAuthenticatedRequest IsAuthenticatedResponse IsGrantedRequest IsGrantedResponse BelongsToRequest BelongsToResponse SubjectRequest SubjectResponse User CreateUserRequest CreateUserResponse GetUserRequest GetUserResponse ListUsersRequest ListUsersResponse DeleteUserRequest DeleteUserResponse ModifyUserRequest ModifyUserResponse ListUserPermissionsRequest ListUserPermissionsResponse SetUserPermissionsRequest SetUserPermissionsResponse ListUserGroupsRequest ListUserGroupsResponse SetUserGroupsRequest SetUserGroupsResponse RegisterPermissionsRequest RegisterPermissionsResponse ListPermissionsRequest ListPermissionsResponse GetPermissionRequest GetPermissionResponse Group CreateGroupRequest CreateGroupResponse GetGroupRequest GetGroupResponse ListGroupsRequest ListGroupsResponse DeleteGroupRequest DeleteGroupResponse ModifyGroupRequest ModifyGroupResponse SetGroupPermissionsRequest SetGroupPermissionsResponse ListGroupPermissionsRequest ListGroupPermissionsResponse
Package charon ...
Index ¶
- Constants
- Variables
- func NewSubjectContext(ctx context.Context, s Subject) context.Context
- func RegisterRPCServer(s *grpc.Server, srv RPCServer)
- type BCryptPasswordHasher
- type BelongsToRequest
- type BelongsToResponse
- type Charon
- type CharonOption
- type CreateGroupRequest
- type CreateGroupResponse
- type CreateUserRequest
- func (*CreateUserRequest) Descriptor() ([]byte, []int)
- func (m *CreateUserRequest) GetIsActive() *ntypes.Bool
- func (m *CreateUserRequest) GetIsConfirmed() *ntypes.Bool
- func (m *CreateUserRequest) GetIsStaff() *ntypes.Bool
- func (m *CreateUserRequest) GetIsSuperuser() *ntypes.Bool
- func (*CreateUserRequest) ProtoMessage()
- func (m *CreateUserRequest) Reset()
- func (m *CreateUserRequest) String() string
- type CreateUserResponse
- type DeleteGroupRequest
- type DeleteGroupResponse
- type DeleteUserRequest
- type DeleteUserResponse
- type GetGroupRequest
- type GetGroupResponse
- type GetPermissionRequest
- type GetPermissionResponse
- type GetUserRequest
- type GetUserResponse
- type Group
- func (*Group) Descriptor() ([]byte, []int)
- func (m *Group) GetCreatedAt() *google_protobuf.Timestamp
- func (m *Group) GetCreatedBy() *ntypes.Int64
- func (m *Group) GetUpdatedAt() *google_protobuf.Timestamp
- func (m *Group) GetUpdatedBy() *ntypes.Int64
- func (*Group) ProtoMessage()
- func (m *Group) Reset()
- func (m *Group) String() string
- type IsAuthenticatedRequest
- type IsAuthenticatedResponse
- type IsGrantedRequest
- type IsGrantedResponse
- type ListGroupPermissionsRequest
- type ListGroupPermissionsResponse
- type ListGroupsRequest
- type ListGroupsResponse
- type ListPermissionsRequest
- func (*ListPermissionsRequest) Descriptor() ([]byte, []int)
- func (m *ListPermissionsRequest) GetAction() *qtypes.String
- func (m *ListPermissionsRequest) GetCreatedAt() *qtypes.Timestamp
- func (m *ListPermissionsRequest) GetCreatedBy() *qtypes.Int64
- func (m *ListPermissionsRequest) GetLimit() *ntypes.Int64
- func (m *ListPermissionsRequest) GetModule() *qtypes.String
- func (m *ListPermissionsRequest) GetOffset() *ntypes.Int64
- func (m *ListPermissionsRequest) GetSort() map[string]bool
- func (m *ListPermissionsRequest) GetSubsystem() *qtypes.String
- func (*ListPermissionsRequest) ProtoMessage()
- func (m *ListPermissionsRequest) Reset()
- func (m *ListPermissionsRequest) String() string
- type ListPermissionsResponse
- type ListUserGroupsRequest
- type ListUserGroupsResponse
- type ListUserPermissionsRequest
- type ListUserPermissionsResponse
- type ListUsersRequest
- func (*ListUsersRequest) Descriptor() ([]byte, []int)
- func (m *ListUsersRequest) GetCreatedBy() *qtypes.Int64
- func (m *ListUsersRequest) GetIsStaff() *ntypes.Bool
- func (m *ListUsersRequest) GetIsSuperuser() *ntypes.Bool
- func (m *ListUsersRequest) GetLimit() *ntypes.Int64
- func (m *ListUsersRequest) GetOffset() *ntypes.Int64
- func (m *ListUsersRequest) GetSort() map[string]bool
- func (*ListUsersRequest) ProtoMessage()
- func (m *ListUsersRequest) Reset()
- func (m *ListUsersRequest) String() string
- type ListUsersResponse
- type LoginRequest
- type LoginResponse
- type LogoutRequest
- type LogoutResponse
- type ModifyGroupRequest
- type ModifyGroupResponse
- type ModifyUserRequest
- func (*ModifyUserRequest) Descriptor() ([]byte, []int)
- func (m *ModifyUserRequest) GetFirstName() *ntypes.String
- func (m *ModifyUserRequest) GetIsActive() *ntypes.Bool
- func (m *ModifyUserRequest) GetIsConfirmed() *ntypes.Bool
- func (m *ModifyUserRequest) GetIsStaff() *ntypes.Bool
- func (m *ModifyUserRequest) GetIsSuperuser() *ntypes.Bool
- func (m *ModifyUserRequest) GetLastName() *ntypes.String
- func (m *ModifyUserRequest) GetPlainPassword() *ntypes.String
- func (m *ModifyUserRequest) GetUsername() *ntypes.String
- func (*ModifyUserRequest) ProtoMessage()
- func (m *ModifyUserRequest) Reset()
- func (m *ModifyUserRequest) String() string
- type ModifyUserResponse
- type PasswordHasher
- type Permission
- func (p Permission) Action() (action string)
- func (p Permission) MarshalJSON() ([]byte, error)
- func (p Permission) Module() (module string)
- func (p Permission) Permission() string
- func (p Permission) Split() (string, string, string)
- func (p Permission) String() string
- func (p Permission) Subsystem() (subsystem string)
- func (p *Permission) UnmarshalJSON(b []byte) error
- type Permissions
- type RPCClient
- type RPCServer
- type RegisterPermissionsRequest
- type RegisterPermissionsResponse
- type SecurityContext
- type SetGroupPermissionsRequest
- type SetGroupPermissionsResponse
- type SetUserGroupsRequest
- type SetUserGroupsResponse
- type SetUserPermissionsRequest
- type SetUserPermissionsResponse
- type Subject
- type SubjectID
- type SubjectRequest
- type SubjectResponse
- type User
- func (*User) Descriptor() ([]byte, []int)
- func (m *User) GetCreatedAt() *google_protobuf.Timestamp
- func (m *User) GetCreatedBy() *ntypes.Int64
- func (m *User) GetUpdatedAt() *google_protobuf.Timestamp
- func (m *User) GetUpdatedBy() *ntypes.Int64
- func (u *User) Name() string
- func (*User) ProtoMessage()
- func (m *User) Reset()
- func (m *User) String() string
Examples ¶
Constants ¶
const ( // ErrDescUserWithIDExists this error should not happen. Id is auto generated. ErrDescUserWithIDExists = "charon: user with such id already exists" // ErrDescUserWithUsernameExists can be returned if client is trying to create or modify a user, // but user with such a username already exists in database. ErrDescUserWithUsernameExists = "charon: user with such username already exists" )
const ( // ErrDescGroupWithIDExists this error should not happen. Id is auto generated. ErrDescGroupWithIDExists = "charon: group with such id already exists" // ErrDescGroupWithNameExists can be returned if client is trying to create or modify a group, // but group with such a name already exists in database. ErrDescGroupWithNameExists = "charon: group with such name already exists" )
Variables ¶
var ( // EmptyPermission is a shorthand EmptyPermission = Permission("") // AllPermissions ... AllPermissions = Permissions{ UserCanCreate, UserCanCreateStaff, UserCanDeleteAsStranger, UserCanDeleteAsOwner, UserCanDeleteStaffAsStranger, UserCanDeleteStaffAsOwner, UserCanModifyAsStranger, UserCanModifyAsOwner, UserCanModifyStaffAsStranger, UserCanModifyStaffAsOwner, UserCanRetrieveAsOwner, UserCanRetrieveAsStranger, UserCanRetrieveStaffAsOwner, UserCanRetrieveStaffAsStranger, UserPermissionCanCreate, UserPermissionCanDelete, UserPermissionCanModify, UserPermissionCanRetrieve, PermissionCanCreate, PermissionCanDelete, PermissionCanModify, PermissionCanRetrieve, GroupCanCreate, GroupCanDelete, GroupCanModify, GroupCanRetrieve, GroupPermissionCanCreate, GroupPermissionCanDelete, GroupPermissionCanModify, GroupPermissionCanRetrieve, } )
var ( // ErrBCryptCostOutOfRange can be returned by NewBCryptPasswordHasher if provided cost is not between min and max. ErrBCryptCostOutOfRange = errors.New("charon: bcrypt cost out of range") )
Functions ¶
func NewSubjectContext ¶
NewSubjectContext returns a new Context that carries Subject value.
func RegisterRPCServer ¶
Types ¶
type BCryptPasswordHasher ¶
type BCryptPasswordHasher struct {
// contains filtered or unexported fields
}
BCryptPasswordHasher hasher that use BCrypt algorithm to secure password.
func (BCryptPasswordHasher) Compare ¶
func (bph BCryptPasswordHasher) Compare(hashedPassword, plainPassword []byte) bool
Compare implements PasswordHasher interface.
type BelongsToRequest ¶
type BelongsToRequest struct { UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` GroupId int64 `protobuf:"varint,2,opt,name=group_id,json=groupId" json:"group_id,omitempty"` }
func (*BelongsToRequest) Descriptor ¶
func (*BelongsToRequest) Descriptor() ([]byte, []int)
func (*BelongsToRequest) ProtoMessage ¶
func (*BelongsToRequest) ProtoMessage()
func (*BelongsToRequest) Reset ¶
func (m *BelongsToRequest) Reset()
func (*BelongsToRequest) String ¶
func (m *BelongsToRequest) String() string
type BelongsToResponse ¶
type BelongsToResponse struct {
Belongs bool `protobuf:"varint,1,opt,name=belongs" json:"belongs,omitempty"`
}
func (*BelongsToResponse) Descriptor ¶
func (*BelongsToResponse) Descriptor() ([]byte, []int)
func (*BelongsToResponse) ProtoMessage ¶
func (*BelongsToResponse) ProtoMessage()
func (*BelongsToResponse) Reset ¶
func (m *BelongsToResponse) Reset()
func (*BelongsToResponse) String ¶
func (m *BelongsToResponse) String() string
type Charon ¶
type Charon interface { IsGranted(context.Context, int64, Permission) (bool, error) IsAuthenticated(context.Context, string) (bool, error) Subject(context.Context, string) (*Subject, error) FromContext(context.Context) (*Subject, error) Login(context.Context, string, string) (*mnemosynerpc.AccessToken, error) Logout(context.Context, string) error }
Charon is an interface that describes simplified client. It contains most commonly used methods. For more powerful low level API check RPCClient interface.
func New ¶
func New(conn *grpc.ClientConn, options ...CharonOption) Charon
New allocates new Charon instance with given options.
type CharonOption ¶
type CharonOption func(*charonOptions)
CharonOption configures how we set up the client.
func WithMetadata ¶
func WithMetadata(kv ...string) CharonOption
WithMetadata sets metadata that will be attachacked to every request.
type CreateGroupRequest ¶
type CreateGroupRequest struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Description *ntypes.String `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` }
func (*CreateGroupRequest) Descriptor ¶
func (*CreateGroupRequest) Descriptor() ([]byte, []int)
func (*CreateGroupRequest) GetDescription ¶
func (m *CreateGroupRequest) GetDescription() *ntypes.String
func (*CreateGroupRequest) ProtoMessage ¶
func (*CreateGroupRequest) ProtoMessage()
func (*CreateGroupRequest) Reset ¶
func (m *CreateGroupRequest) Reset()
func (*CreateGroupRequest) String ¶
func (m *CreateGroupRequest) String() string
type CreateGroupResponse ¶
type CreateGroupResponse struct {
Group *Group `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"`
}
func (*CreateGroupResponse) Descriptor ¶
func (*CreateGroupResponse) Descriptor() ([]byte, []int)
func (*CreateGroupResponse) GetGroup ¶
func (m *CreateGroupResponse) GetGroup() *Group
func (*CreateGroupResponse) ProtoMessage ¶
func (*CreateGroupResponse) ProtoMessage()
func (*CreateGroupResponse) Reset ¶
func (m *CreateGroupResponse) Reset()
func (*CreateGroupResponse) String ¶
func (m *CreateGroupResponse) String() string
type CreateUserRequest ¶
type CreateUserRequest struct { Username string `protobuf:"bytes,1,opt,name=username" json:"username,omitempty"` PlainPassword string `protobuf:"bytes,2,opt,name=plain_password,json=plainPassword" json:"plain_password,omitempty"` SecurePassword []byte `protobuf:"bytes,3,opt,name=secure_password,json=securePassword,proto3" json:"secure_password,omitempty"` FirstName string `protobuf:"bytes,4,opt,name=first_name,json=firstName" json:"first_name,omitempty"` LastName string `protobuf:"bytes,5,opt,name=last_name,json=lastName" json:"last_name,omitempty"` IsSuperuser *ntypes.Bool `protobuf:"bytes,6,opt,name=is_superuser,json=isSuperuser" json:"is_superuser,omitempty"` IsActive *ntypes.Bool `protobuf:"bytes,7,opt,name=is_active,json=isActive" json:"is_active,omitempty"` IsStaff *ntypes.Bool `protobuf:"bytes,8,opt,name=is_staff,json=isStaff" json:"is_staff,omitempty"` IsConfirmed *ntypes.Bool `protobuf:"bytes,9,opt,name=is_confirmed,json=isConfirmed" json:"is_confirmed,omitempty"` }
func (*CreateUserRequest) Descriptor ¶
func (*CreateUserRequest) Descriptor() ([]byte, []int)
func (*CreateUserRequest) GetIsActive ¶
func (m *CreateUserRequest) GetIsActive() *ntypes.Bool
func (*CreateUserRequest) GetIsConfirmed ¶
func (m *CreateUserRequest) GetIsConfirmed() *ntypes.Bool
func (*CreateUserRequest) GetIsStaff ¶
func (m *CreateUserRequest) GetIsStaff() *ntypes.Bool
func (*CreateUserRequest) GetIsSuperuser ¶
func (m *CreateUserRequest) GetIsSuperuser() *ntypes.Bool
func (*CreateUserRequest) ProtoMessage ¶
func (*CreateUserRequest) ProtoMessage()
func (*CreateUserRequest) Reset ¶
func (m *CreateUserRequest) Reset()
func (*CreateUserRequest) String ¶
func (m *CreateUserRequest) String() string
type CreateUserResponse ¶
type CreateUserResponse struct {
User *User `protobuf:"bytes,1,opt,name=user" json:"user,omitempty"`
}
func (*CreateUserResponse) Descriptor ¶
func (*CreateUserResponse) Descriptor() ([]byte, []int)
func (*CreateUserResponse) GetUser ¶
func (m *CreateUserResponse) GetUser() *User
func (*CreateUserResponse) ProtoMessage ¶
func (*CreateUserResponse) ProtoMessage()
func (*CreateUserResponse) Reset ¶
func (m *CreateUserResponse) Reset()
func (*CreateUserResponse) String ¶
func (m *CreateUserResponse) String() string
type DeleteGroupRequest ¶
type DeleteGroupRequest struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*DeleteGroupRequest) Descriptor ¶
func (*DeleteGroupRequest) Descriptor() ([]byte, []int)
func (*DeleteGroupRequest) ProtoMessage ¶
func (*DeleteGroupRequest) ProtoMessage()
func (*DeleteGroupRequest) Reset ¶
func (m *DeleteGroupRequest) Reset()
func (*DeleteGroupRequest) String ¶
func (m *DeleteGroupRequest) String() string
type DeleteGroupResponse ¶
type DeleteGroupResponse struct {
Affected int64 `protobuf:"varint,1,opt,name=affected" json:"affected,omitempty"`
}
func (*DeleteGroupResponse) Descriptor ¶
func (*DeleteGroupResponse) Descriptor() ([]byte, []int)
func (*DeleteGroupResponse) ProtoMessage ¶
func (*DeleteGroupResponse) ProtoMessage()
func (*DeleteGroupResponse) Reset ¶
func (m *DeleteGroupResponse) Reset()
func (*DeleteGroupResponse) String ¶
func (m *DeleteGroupResponse) String() string
type DeleteUserRequest ¶
type DeleteUserRequest struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*DeleteUserRequest) Descriptor ¶
func (*DeleteUserRequest) Descriptor() ([]byte, []int)
func (*DeleteUserRequest) ProtoMessage ¶
func (*DeleteUserRequest) ProtoMessage()
func (*DeleteUserRequest) Reset ¶
func (m *DeleteUserRequest) Reset()
func (*DeleteUserRequest) String ¶
func (m *DeleteUserRequest) String() string
type DeleteUserResponse ¶
type DeleteUserResponse struct {
Affected int64 `protobuf:"varint,1,opt,name=affected" json:"affected,omitempty"`
}
func (*DeleteUserResponse) Descriptor ¶
func (*DeleteUserResponse) Descriptor() ([]byte, []int)
func (*DeleteUserResponse) ProtoMessage ¶
func (*DeleteUserResponse) ProtoMessage()
func (*DeleteUserResponse) Reset ¶
func (m *DeleteUserResponse) Reset()
func (*DeleteUserResponse) String ¶
func (m *DeleteUserResponse) String() string
type GetGroupRequest ¶
type GetGroupRequest struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*GetGroupRequest) Descriptor ¶
func (*GetGroupRequest) Descriptor() ([]byte, []int)
func (*GetGroupRequest) ProtoMessage ¶
func (*GetGroupRequest) ProtoMessage()
func (*GetGroupRequest) Reset ¶
func (m *GetGroupRequest) Reset()
func (*GetGroupRequest) String ¶
func (m *GetGroupRequest) String() string
type GetGroupResponse ¶
type GetGroupResponse struct {
Group *Group `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"`
}
func (*GetGroupResponse) Descriptor ¶
func (*GetGroupResponse) Descriptor() ([]byte, []int)
func (*GetGroupResponse) GetGroup ¶
func (m *GetGroupResponse) GetGroup() *Group
func (*GetGroupResponse) ProtoMessage ¶
func (*GetGroupResponse) ProtoMessage()
func (*GetGroupResponse) Reset ¶
func (m *GetGroupResponse) Reset()
func (*GetGroupResponse) String ¶
func (m *GetGroupResponse) String() string
type GetPermissionRequest ¶
type GetPermissionRequest struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*GetPermissionRequest) Descriptor ¶
func (*GetPermissionRequest) Descriptor() ([]byte, []int)
func (*GetPermissionRequest) ProtoMessage ¶
func (*GetPermissionRequest) ProtoMessage()
func (*GetPermissionRequest) Reset ¶
func (m *GetPermissionRequest) Reset()
func (*GetPermissionRequest) String ¶
func (m *GetPermissionRequest) String() string
type GetPermissionResponse ¶
type GetPermissionResponse struct {
Permission string `protobuf:"bytes,1,opt,name=permission" json:"permission,omitempty"`
}
func (*GetPermissionResponse) Descriptor ¶
func (*GetPermissionResponse) Descriptor() ([]byte, []int)
func (*GetPermissionResponse) ProtoMessage ¶
func (*GetPermissionResponse) ProtoMessage()
func (*GetPermissionResponse) Reset ¶
func (m *GetPermissionResponse) Reset()
func (*GetPermissionResponse) String ¶
func (m *GetPermissionResponse) String() string
type GetUserRequest ¶
type GetUserRequest struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*GetUserRequest) Descriptor ¶
func (*GetUserRequest) Descriptor() ([]byte, []int)
func (*GetUserRequest) ProtoMessage ¶
func (*GetUserRequest) ProtoMessage()
func (*GetUserRequest) Reset ¶
func (m *GetUserRequest) Reset()
func (*GetUserRequest) String ¶
func (m *GetUserRequest) String() string
type GetUserResponse ¶
type GetUserResponse struct {
User *User `protobuf:"bytes,1,opt,name=user" json:"user,omitempty"`
}
func (*GetUserResponse) Descriptor ¶
func (*GetUserResponse) Descriptor() ([]byte, []int)
func (*GetUserResponse) GetUser ¶
func (m *GetUserResponse) GetUser() *User
func (*GetUserResponse) ProtoMessage ¶
func (*GetUserResponse) ProtoMessage()
func (*GetUserResponse) Reset ¶
func (m *GetUserResponse) Reset()
func (*GetUserResponse) String ¶
func (m *GetUserResponse) String() string
type Group ¶
type Group struct { Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` CreatedAt *google_protobuf.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` CreatedBy *ntypes.Int64 `protobuf:"bytes,5,opt,name=created_by,json=createdBy" json:"created_by,omitempty"` UpdatedAt *google_protobuf.Timestamp `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt" json:"updated_at,omitempty"` UpdatedBy *ntypes.Int64 `protobuf:"bytes,7,opt,name=updated_by,json=updatedBy" json:"updated_by,omitempty"` }
func (*Group) Descriptor ¶
func (*Group) GetCreatedAt ¶
func (m *Group) GetCreatedAt() *google_protobuf.Timestamp
func (*Group) GetCreatedBy ¶
func (*Group) GetUpdatedAt ¶
func (m *Group) GetUpdatedAt() *google_protobuf.Timestamp
func (*Group) GetUpdatedBy ¶
func (*Group) ProtoMessage ¶
func (*Group) ProtoMessage()
type IsAuthenticatedRequest ¶
type IsAuthenticatedRequest struct {
AccessToken *mnemosynerpc.AccessToken `protobuf:"bytes,1,opt,name=access_token,json=accessToken" json:"access_token,omitempty"`
}
func (*IsAuthenticatedRequest) Descriptor ¶
func (*IsAuthenticatedRequest) Descriptor() ([]byte, []int)
func (*IsAuthenticatedRequest) GetAccessToken ¶
func (m *IsAuthenticatedRequest) GetAccessToken() *mnemosynerpc.AccessToken
func (*IsAuthenticatedRequest) ProtoMessage ¶
func (*IsAuthenticatedRequest) ProtoMessage()
func (*IsAuthenticatedRequest) Reset ¶
func (m *IsAuthenticatedRequest) Reset()
func (*IsAuthenticatedRequest) String ¶
func (m *IsAuthenticatedRequest) String() string
type IsAuthenticatedResponse ¶
type IsAuthenticatedResponse struct {
Authenticated bool `protobuf:"varint,1,opt,name=authenticated" json:"authenticated,omitempty"`
}
func (*IsAuthenticatedResponse) Descriptor ¶
func (*IsAuthenticatedResponse) Descriptor() ([]byte, []int)
func (*IsAuthenticatedResponse) ProtoMessage ¶
func (*IsAuthenticatedResponse) ProtoMessage()
func (*IsAuthenticatedResponse) Reset ¶
func (m *IsAuthenticatedResponse) Reset()
func (*IsAuthenticatedResponse) String ¶
func (m *IsAuthenticatedResponse) String() string
type IsGrantedRequest ¶
type IsGrantedRequest struct { UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` Permission string `protobuf:"bytes,2,opt,name=permission" json:"permission,omitempty"` }
func (*IsGrantedRequest) Descriptor ¶
func (*IsGrantedRequest) Descriptor() ([]byte, []int)
func (*IsGrantedRequest) ProtoMessage ¶
func (*IsGrantedRequest) ProtoMessage()
func (*IsGrantedRequest) Reset ¶
func (m *IsGrantedRequest) Reset()
func (*IsGrantedRequest) String ¶
func (m *IsGrantedRequest) String() string
type IsGrantedResponse ¶
type IsGrantedResponse struct {
Granted bool `protobuf:"varint,1,opt,name=granted" json:"granted,omitempty"`
}
func (*IsGrantedResponse) Descriptor ¶
func (*IsGrantedResponse) Descriptor() ([]byte, []int)
func (*IsGrantedResponse) ProtoMessage ¶
func (*IsGrantedResponse) ProtoMessage()
func (*IsGrantedResponse) Reset ¶
func (m *IsGrantedResponse) Reset()
func (*IsGrantedResponse) String ¶
func (m *IsGrantedResponse) String() string
type ListGroupPermissionsRequest ¶
type ListGroupPermissionsRequest struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*ListGroupPermissionsRequest) Descriptor ¶
func (*ListGroupPermissionsRequest) Descriptor() ([]byte, []int)
func (*ListGroupPermissionsRequest) ProtoMessage ¶
func (*ListGroupPermissionsRequest) ProtoMessage()
func (*ListGroupPermissionsRequest) Reset ¶
func (m *ListGroupPermissionsRequest) Reset()
func (*ListGroupPermissionsRequest) String ¶
func (m *ListGroupPermissionsRequest) String() string
type ListGroupPermissionsResponse ¶
type ListGroupPermissionsResponse struct {
Permissions []string `protobuf:"bytes,1,rep,name=permissions" json:"permissions,omitempty"`
}
func (*ListGroupPermissionsResponse) Descriptor ¶
func (*ListGroupPermissionsResponse) Descriptor() ([]byte, []int)
func (*ListGroupPermissionsResponse) ProtoMessage ¶
func (*ListGroupPermissionsResponse) ProtoMessage()
func (*ListGroupPermissionsResponse) Reset ¶
func (m *ListGroupPermissionsResponse) Reset()
func (*ListGroupPermissionsResponse) String ¶
func (m *ListGroupPermissionsResponse) String() string
type ListGroupsRequest ¶
type ListGroupsRequest struct { Offset *ntypes.Int64 `protobuf:"bytes,100,opt,name=offset" json:"offset,omitempty"` Limit *ntypes.Int64 `protobuf:"bytes,101,opt,name=limit" json:"limit,omitempty"` }
func (*ListGroupsRequest) Descriptor ¶
func (*ListGroupsRequest) Descriptor() ([]byte, []int)
func (*ListGroupsRequest) GetLimit ¶
func (m *ListGroupsRequest) GetLimit() *ntypes.Int64
func (*ListGroupsRequest) GetOffset ¶
func (m *ListGroupsRequest) GetOffset() *ntypes.Int64
func (*ListGroupsRequest) ProtoMessage ¶
func (*ListGroupsRequest) ProtoMessage()
func (*ListGroupsRequest) Reset ¶
func (m *ListGroupsRequest) Reset()
func (*ListGroupsRequest) String ¶
func (m *ListGroupsRequest) String() string
type ListGroupsResponse ¶
type ListGroupsResponse struct {
Groups []*Group `protobuf:"bytes,1,rep,name=groups" json:"groups,omitempty"`
}
func (*ListGroupsResponse) Descriptor ¶
func (*ListGroupsResponse) Descriptor() ([]byte, []int)
func (*ListGroupsResponse) GetGroups ¶
func (m *ListGroupsResponse) GetGroups() []*Group
func (*ListGroupsResponse) ProtoMessage ¶
func (*ListGroupsResponse) ProtoMessage()
func (*ListGroupsResponse) Reset ¶
func (m *ListGroupsResponse) Reset()
func (*ListGroupsResponse) String ¶
func (m *ListGroupsResponse) String() string
type ListPermissionsRequest ¶
type ListPermissionsRequest struct { Subsystem *qtypes.String `protobuf:"bytes,1,opt,name=subsystem" json:"subsystem,omitempty"` Module *qtypes.String `protobuf:"bytes,2,opt,name=module" json:"module,omitempty"` Action *qtypes.String `protobuf:"bytes,3,opt,name=action" json:"action,omitempty"` CreatedAt *qtypes.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` CreatedBy *qtypes.Int64 `protobuf:"bytes,5,opt,name=created_by,json=createdBy" json:"created_by,omitempty"` Offset *ntypes.Int64 `protobuf:"bytes,100,opt,name=offset" json:"offset,omitempty"` Limit *ntypes.Int64 `protobuf:"bytes,101,opt,name=limit" json:"limit,omitempty"` Sort map[string]bool `` /* 131-byte string literal not displayed */ }
func (*ListPermissionsRequest) Descriptor ¶
func (*ListPermissionsRequest) Descriptor() ([]byte, []int)
func (*ListPermissionsRequest) GetAction ¶
func (m *ListPermissionsRequest) GetAction() *qtypes.String
func (*ListPermissionsRequest) GetCreatedAt ¶
func (m *ListPermissionsRequest) GetCreatedAt() *qtypes.Timestamp
func (*ListPermissionsRequest) GetCreatedBy ¶
func (m *ListPermissionsRequest) GetCreatedBy() *qtypes.Int64
func (*ListPermissionsRequest) GetLimit ¶
func (m *ListPermissionsRequest) GetLimit() *ntypes.Int64
func (*ListPermissionsRequest) GetModule ¶
func (m *ListPermissionsRequest) GetModule() *qtypes.String
func (*ListPermissionsRequest) GetOffset ¶
func (m *ListPermissionsRequest) GetOffset() *ntypes.Int64
func (*ListPermissionsRequest) GetSort ¶
func (m *ListPermissionsRequest) GetSort() map[string]bool
func (*ListPermissionsRequest) GetSubsystem ¶
func (m *ListPermissionsRequest) GetSubsystem() *qtypes.String
func (*ListPermissionsRequest) ProtoMessage ¶
func (*ListPermissionsRequest) ProtoMessage()
func (*ListPermissionsRequest) Reset ¶
func (m *ListPermissionsRequest) Reset()
func (*ListPermissionsRequest) String ¶
func (m *ListPermissionsRequest) String() string
type ListPermissionsResponse ¶
type ListPermissionsResponse struct {
Permissions []string `protobuf:"bytes,1,rep,name=permissions" json:"permissions,omitempty"`
}
func (*ListPermissionsResponse) Descriptor ¶
func (*ListPermissionsResponse) Descriptor() ([]byte, []int)
func (*ListPermissionsResponse) ProtoMessage ¶
func (*ListPermissionsResponse) ProtoMessage()
func (*ListPermissionsResponse) Reset ¶
func (m *ListPermissionsResponse) Reset()
func (*ListPermissionsResponse) String ¶
func (m *ListPermissionsResponse) String() string
type ListUserGroupsRequest ¶
type ListUserGroupsRequest struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*ListUserGroupsRequest) Descriptor ¶
func (*ListUserGroupsRequest) Descriptor() ([]byte, []int)
func (*ListUserGroupsRequest) ProtoMessage ¶
func (*ListUserGroupsRequest) ProtoMessage()
func (*ListUserGroupsRequest) Reset ¶
func (m *ListUserGroupsRequest) Reset()
func (*ListUserGroupsRequest) String ¶
func (m *ListUserGroupsRequest) String() string
type ListUserGroupsResponse ¶
type ListUserGroupsResponse struct {
Groups []*Group `protobuf:"bytes,1,rep,name=groups" json:"groups,omitempty"`
}
func (*ListUserGroupsResponse) Descriptor ¶
func (*ListUserGroupsResponse) Descriptor() ([]byte, []int)
func (*ListUserGroupsResponse) GetGroups ¶
func (m *ListUserGroupsResponse) GetGroups() []*Group
func (*ListUserGroupsResponse) ProtoMessage ¶
func (*ListUserGroupsResponse) ProtoMessage()
func (*ListUserGroupsResponse) Reset ¶
func (m *ListUserGroupsResponse) Reset()
func (*ListUserGroupsResponse) String ¶
func (m *ListUserGroupsResponse) String() string
type ListUserPermissionsRequest ¶
type ListUserPermissionsRequest struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*ListUserPermissionsRequest) Descriptor ¶
func (*ListUserPermissionsRequest) Descriptor() ([]byte, []int)
func (*ListUserPermissionsRequest) ProtoMessage ¶
func (*ListUserPermissionsRequest) ProtoMessage()
func (*ListUserPermissionsRequest) Reset ¶
func (m *ListUserPermissionsRequest) Reset()
func (*ListUserPermissionsRequest) String ¶
func (m *ListUserPermissionsRequest) String() string
type ListUserPermissionsResponse ¶
type ListUserPermissionsResponse struct {
Permissions []string `protobuf:"bytes,1,rep,name=permissions" json:"permissions,omitempty"`
}
func (*ListUserPermissionsResponse) Descriptor ¶
func (*ListUserPermissionsResponse) Descriptor() ([]byte, []int)
func (*ListUserPermissionsResponse) ProtoMessage ¶
func (*ListUserPermissionsResponse) ProtoMessage()
func (*ListUserPermissionsResponse) Reset ¶
func (m *ListUserPermissionsResponse) Reset()
func (*ListUserPermissionsResponse) String ¶
func (m *ListUserPermissionsResponse) String() string
type ListUsersRequest ¶
type ListUsersRequest struct { IsSuperuser *ntypes.Bool `protobuf:"bytes,1,opt,name=is_superuser,json=isSuperuser" json:"is_superuser,omitempty"` IsStaff *ntypes.Bool `protobuf:"bytes,2,opt,name=is_staff,json=isStaff" json:"is_staff,omitempty"` CreatedBy *qtypes.Int64 `protobuf:"bytes,3,opt,name=created_by,json=createdBy" json:"created_by,omitempty"` Offset *ntypes.Int64 `protobuf:"bytes,100,opt,name=offset" json:"offset,omitempty"` Limit *ntypes.Int64 `protobuf:"bytes,101,opt,name=limit" json:"limit,omitempty"` Sort map[string]bool `` /* 131-byte string literal not displayed */ }
func (*ListUsersRequest) Descriptor ¶
func (*ListUsersRequest) Descriptor() ([]byte, []int)
func (*ListUsersRequest) GetCreatedBy ¶
func (m *ListUsersRequest) GetCreatedBy() *qtypes.Int64
func (*ListUsersRequest) GetIsStaff ¶
func (m *ListUsersRequest) GetIsStaff() *ntypes.Bool
func (*ListUsersRequest) GetIsSuperuser ¶
func (m *ListUsersRequest) GetIsSuperuser() *ntypes.Bool
func (*ListUsersRequest) GetLimit ¶
func (m *ListUsersRequest) GetLimit() *ntypes.Int64
func (*ListUsersRequest) GetOffset ¶
func (m *ListUsersRequest) GetOffset() *ntypes.Int64
func (*ListUsersRequest) GetSort ¶
func (m *ListUsersRequest) GetSort() map[string]bool
func (*ListUsersRequest) ProtoMessage ¶
func (*ListUsersRequest) ProtoMessage()
func (*ListUsersRequest) Reset ¶
func (m *ListUsersRequest) Reset()
func (*ListUsersRequest) String ¶
func (m *ListUsersRequest) String() string
type ListUsersResponse ¶
type ListUsersResponse struct {
Users []*User `protobuf:"bytes,1,rep,name=users" json:"users,omitempty"`
}
func (*ListUsersResponse) Descriptor ¶
func (*ListUsersResponse) Descriptor() ([]byte, []int)
func (*ListUsersResponse) GetUsers ¶
func (m *ListUsersResponse) GetUsers() []*User
func (*ListUsersResponse) ProtoMessage ¶
func (*ListUsersResponse) ProtoMessage()
func (*ListUsersResponse) Reset ¶
func (m *ListUsersResponse) Reset()
func (*ListUsersResponse) String ¶
func (m *ListUsersResponse) String() string
type LoginRequest ¶
type LoginRequest struct { Username string `protobuf:"bytes,1,opt,name=username" json:"username,omitempty"` Password string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"` Client string `protobuf:"bytes,3,opt,name=client" json:"client,omitempty"` }
func (*LoginRequest) Descriptor ¶
func (*LoginRequest) Descriptor() ([]byte, []int)
func (*LoginRequest) ProtoMessage ¶
func (*LoginRequest) ProtoMessage()
func (*LoginRequest) Reset ¶
func (m *LoginRequest) Reset()
func (*LoginRequest) String ¶
func (m *LoginRequest) String() string
type LoginResponse ¶
type LoginResponse struct {
AccessToken *mnemosynerpc.AccessToken `protobuf:"bytes,1,opt,name=access_token,json=accessToken" json:"access_token,omitempty"`
}
func (*LoginResponse) Descriptor ¶
func (*LoginResponse) Descriptor() ([]byte, []int)
func (*LoginResponse) GetAccessToken ¶
func (m *LoginResponse) GetAccessToken() *mnemosynerpc.AccessToken
func (*LoginResponse) ProtoMessage ¶
func (*LoginResponse) ProtoMessage()
func (*LoginResponse) Reset ¶
func (m *LoginResponse) Reset()
func (*LoginResponse) String ¶
func (m *LoginResponse) String() string
type LogoutRequest ¶
type LogoutRequest struct {
AccessToken *mnemosynerpc.AccessToken `protobuf:"bytes,1,opt,name=access_token,json=accessToken" json:"access_token,omitempty"`
}
func (*LogoutRequest) Descriptor ¶
func (*LogoutRequest) Descriptor() ([]byte, []int)
func (*LogoutRequest) GetAccessToken ¶
func (m *LogoutRequest) GetAccessToken() *mnemosynerpc.AccessToken
func (*LogoutRequest) ProtoMessage ¶
func (*LogoutRequest) ProtoMessage()
func (*LogoutRequest) Reset ¶
func (m *LogoutRequest) Reset()
func (*LogoutRequest) String ¶
func (m *LogoutRequest) String() string
type LogoutResponse ¶
type LogoutResponse struct { }
func (*LogoutResponse) Descriptor ¶
func (*LogoutResponse) Descriptor() ([]byte, []int)
func (*LogoutResponse) ProtoMessage ¶
func (*LogoutResponse) ProtoMessage()
func (*LogoutResponse) Reset ¶
func (m *LogoutResponse) Reset()
func (*LogoutResponse) String ¶
func (m *LogoutResponse) String() string
type ModifyGroupRequest ¶
type ModifyGroupRequest struct { Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Name *ntypes.String `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` Description *ntypes.String `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` }
func (*ModifyGroupRequest) Descriptor ¶
func (*ModifyGroupRequest) Descriptor() ([]byte, []int)
func (*ModifyGroupRequest) GetDescription ¶
func (m *ModifyGroupRequest) GetDescription() *ntypes.String
func (*ModifyGroupRequest) GetName ¶
func (m *ModifyGroupRequest) GetName() *ntypes.String
func (*ModifyGroupRequest) ProtoMessage ¶
func (*ModifyGroupRequest) ProtoMessage()
func (*ModifyGroupRequest) Reset ¶
func (m *ModifyGroupRequest) Reset()
func (*ModifyGroupRequest) String ¶
func (m *ModifyGroupRequest) String() string
type ModifyGroupResponse ¶
type ModifyGroupResponse struct {
Group *Group `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"`
}
func (*ModifyGroupResponse) Descriptor ¶
func (*ModifyGroupResponse) Descriptor() ([]byte, []int)
func (*ModifyGroupResponse) GetGroup ¶
func (m *ModifyGroupResponse) GetGroup() *Group
func (*ModifyGroupResponse) ProtoMessage ¶
func (*ModifyGroupResponse) ProtoMessage()
func (*ModifyGroupResponse) Reset ¶
func (m *ModifyGroupResponse) Reset()
func (*ModifyGroupResponse) String ¶
func (m *ModifyGroupResponse) String() string
type ModifyUserRequest ¶
type ModifyUserRequest struct { Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Username *ntypes.String `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"` PlainPassword *ntypes.String `protobuf:"bytes,3,opt,name=plain_password,json=plainPassword" json:"plain_password,omitempty"` SecurePassword []byte `protobuf:"bytes,4,opt,name=secure_password,json=securePassword,proto3" json:"secure_password,omitempty"` FirstName *ntypes.String `protobuf:"bytes,5,opt,name=first_name,json=firstName" json:"first_name,omitempty"` LastName *ntypes.String `protobuf:"bytes,6,opt,name=last_name,json=lastName" json:"last_name,omitempty"` IsSuperuser *ntypes.Bool `protobuf:"bytes,7,opt,name=is_superuser,json=isSuperuser" json:"is_superuser,omitempty"` IsActive *ntypes.Bool `protobuf:"bytes,8,opt,name=is_active,json=isActive" json:"is_active,omitempty"` IsStaff *ntypes.Bool `protobuf:"bytes,9,opt,name=is_staff,json=isStaff" json:"is_staff,omitempty"` IsConfirmed *ntypes.Bool `protobuf:"bytes,10,opt,name=is_confirmed,json=isConfirmed" json:"is_confirmed,omitempty"` }
func (*ModifyUserRequest) Descriptor ¶
func (*ModifyUserRequest) Descriptor() ([]byte, []int)
func (*ModifyUserRequest) GetFirstName ¶
func (m *ModifyUserRequest) GetFirstName() *ntypes.String
func (*ModifyUserRequest) GetIsActive ¶
func (m *ModifyUserRequest) GetIsActive() *ntypes.Bool
func (*ModifyUserRequest) GetIsConfirmed ¶
func (m *ModifyUserRequest) GetIsConfirmed() *ntypes.Bool
func (*ModifyUserRequest) GetIsStaff ¶
func (m *ModifyUserRequest) GetIsStaff() *ntypes.Bool
func (*ModifyUserRequest) GetIsSuperuser ¶
func (m *ModifyUserRequest) GetIsSuperuser() *ntypes.Bool
func (*ModifyUserRequest) GetLastName ¶
func (m *ModifyUserRequest) GetLastName() *ntypes.String
func (*ModifyUserRequest) GetPlainPassword ¶
func (m *ModifyUserRequest) GetPlainPassword() *ntypes.String
func (*ModifyUserRequest) GetUsername ¶
func (m *ModifyUserRequest) GetUsername() *ntypes.String
func (*ModifyUserRequest) ProtoMessage ¶
func (*ModifyUserRequest) ProtoMessage()
func (*ModifyUserRequest) Reset ¶
func (m *ModifyUserRequest) Reset()
func (*ModifyUserRequest) String ¶
func (m *ModifyUserRequest) String() string
type ModifyUserResponse ¶
type ModifyUserResponse struct {
User *User `protobuf:"bytes,1,opt,name=user" json:"user,omitempty"`
}
func (*ModifyUserResponse) Descriptor ¶
func (*ModifyUserResponse) Descriptor() ([]byte, []int)
func (*ModifyUserResponse) GetUser ¶
func (m *ModifyUserResponse) GetUser() *User
func (*ModifyUserResponse) ProtoMessage ¶
func (*ModifyUserResponse) ProtoMessage()
func (*ModifyUserResponse) Reset ¶
func (m *ModifyUserResponse) Reset()
func (*ModifyUserResponse) String ¶
func (m *ModifyUserResponse) String() string
type PasswordHasher ¶
PasswordHasher define set of methods that object needs to implement to be considered as a hasher.
func NewBCryptPasswordHasher ¶
func NewBCryptPasswordHasher(cost int) (PasswordHasher, error)
NewBCryptPasswordHasher allocates new BCryptPasswordHasher. If cost is not between min and max value it returns an error.
type Permission ¶
type Permission string
Permission is a string that consist of subsystem, module/content type and an action.
const ( UserCanCreate Permission = "charon:user:can create" UserCanCreateStaff Permission = "charon:user:can create staff" UserCanDeleteAsStranger Permission = "charon:user:can delete as stranger" UserCanDeleteAsOwner Permission = "charon:user:can delete as owner" UserCanDeleteStaffAsStranger Permission = "charon:user:can delete staff as stranger" UserCanDeleteStaffAsOwner Permission = "charon:user:can delete staff as owner" UserCanModifyAsStranger Permission = "charon:user:can modify as stranger" UserCanModifyAsOwner Permission = "charon:user:can modify as owner" UserCanModifyStaffAsStranger Permission = "charon:user:can modify staff as stranger" UserCanModifyStaffAsOwner Permission = "charon:user:can modify staff as owner" UserCanRetrieveAsOwner Permission = "charon:user:can retrieve as owner" UserCanRetrieveAsStranger Permission = "charon:user:can retrieve as stranger" UserCanRetrieveStaffAsOwner Permission = "charon:user:can retrieve staff as owner" UserCanRetrieveStaffAsStranger Permission = "charon:user:can retrieve staff as stranger" UserPermissionCanCreate Permission = "charon:user_permission:can create" UserPermissionCanDelete Permission = "charon:user_permission:can delete" UserPermissionCanModify Permission = "charon:user_permission:can modify" UserPermissionCanRetrieve Permission = "charon:user_permission:can retrieve" UserPermissionCanCheckGrantingAsStranger Permission = "charon:user_permission:can check granting as a stranger" UserGroupCanCreate Permission = "charon:user_group:can create" UserGroupCanDelete Permission = "charon:user_group:can delete" UserGroupCanModify Permission = "charon:user_group:can modify" UserGroupCanRetrieve Permission = "charon:user_group:can retrieve" UserGroupCanCheckBelongingAsStranger Permission = "charon:user_group:can check belonging as a stranger" PermissionCanCreate Permission = "charon:permission:can create" PermissionCanDelete Permission = "charon:permission:can delete" PermissionCanModify Permission = "charon:permission:can modify" PermissionCanRetrieve Permission = "charon:permission:can retrieve" GroupCanCreate Permission = "charon:group:can create" GroupCanDelete Permission = "charon:group:can delete" GroupCanModify Permission = "charon:group:can modify" GroupCanRetrieve Permission = "charon:group:can retrieve" GroupPermissionCanCreate Permission = "charon:group_permission:can create" GroupPermissionCanDelete Permission = "charon:group_permission:can delete" GroupPermissionCanModify Permission = "charon:group_permission:can modify" GroupPermissionCanRetrieve Permission = "charon:group_permission:can retrieve" )
func (Permission) Action ¶
func (p Permission) Action() (action string)
Action is a handy wrapper for Split method, that just returns action.
func (Permission) MarshalJSON ¶
func (p Permission) MarshalJSON() ([]byte, error)
MarshalJSON implements json Marshaller interface.
func (Permission) Module ¶
func (p Permission) Module() (module string)
Module is a handy wrapper for Split method, that just returns module.
func (Permission) Permission ¶
func (p Permission) Permission() string
Permission implements Permission interface.
func (Permission) Split ¶
func (p Permission) Split() (string, string, string)
Split returns subsystem, module/content ty and action that describes single Permission.
func (Permission) String ¶
func (p Permission) String() string
String implements fmt.Stringer interface.
func (Permission) Subsystem ¶
func (p Permission) Subsystem() (subsystem string)
Subsystem is a handy wrapper for Split method, that just returns subsystem.
func (*Permission) UnmarshalJSON ¶
func (p *Permission) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json Unmarshaler interface.
type Permissions ¶
type Permissions []Permission
func NewPermissions ¶
func NewPermissions(ss ...string) Permissions
NewPermissions allocates new Permissions using given slice of strings. It maps each string in a slice into Permission.
func (Permissions) Contains ¶
func (p Permissions) Contains(permissions ...Permission) bool
Contains returns true if given Permission exists in the collection. If none is provided returns false.
func (Permissions) Strings ¶
func (p Permissions) Strings() (s []string)
Strings maps Permissions into slice of strings.
type RPCClient ¶
type RPCClient interface { Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutResponse, error) IsAuthenticated(ctx context.Context, in *IsAuthenticatedRequest, opts ...grpc.CallOption) (*IsAuthenticatedResponse, error) Subject(ctx context.Context, in *SubjectRequest, opts ...grpc.CallOption) (*SubjectResponse, error) IsGranted(ctx context.Context, in *IsGrantedRequest, opts ...grpc.CallOption) (*IsGrantedResponse, error) BelongsTo(ctx context.Context, in *BelongsToRequest, opts ...grpc.CallOption) (*BelongsToResponse, error) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) ModifyUser(ctx context.Context, in *ModifyUserRequest, opts ...grpc.CallOption) (*ModifyUserResponse, error) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) ListUserPermissions(ctx context.Context, in *ListUserPermissionsRequest, opts ...grpc.CallOption) (*ListUserPermissionsResponse, error) SetUserPermissions(ctx context.Context, in *SetUserPermissionsRequest, opts ...grpc.CallOption) (*SetUserPermissionsResponse, error) ListUserGroups(ctx context.Context, in *ListUserGroupsRequest, opts ...grpc.CallOption) (*ListUserGroupsResponse, error) SetUserGroups(ctx context.Context, in *SetUserGroupsRequest, opts ...grpc.CallOption) (*SetUserGroupsResponse, error) RegisterPermissions(ctx context.Context, in *RegisterPermissionsRequest, opts ...grpc.CallOption) (*RegisterPermissionsResponse, error) ListPermissions(ctx context.Context, in *ListPermissionsRequest, opts ...grpc.CallOption) (*ListPermissionsResponse, error) GetPermission(ctx context.Context, in *GetPermissionRequest, opts ...grpc.CallOption) (*GetPermissionResponse, error) CreateGroup(ctx context.Context, in *CreateGroupRequest, opts ...grpc.CallOption) (*CreateGroupResponse, error) ModifyGroup(ctx context.Context, in *ModifyGroupRequest, opts ...grpc.CallOption) (*ModifyGroupResponse, error) GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*GetGroupResponse, error) ListGroups(ctx context.Context, in *ListGroupsRequest, opts ...grpc.CallOption) (*ListGroupsResponse, error) DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...grpc.CallOption) (*DeleteGroupResponse, error) ListGroupPermissions(ctx context.Context, in *ListGroupPermissionsRequest, opts ...grpc.CallOption) (*ListGroupPermissionsResponse, error) SetGroupPermissions(ctx context.Context, in *SetGroupPermissionsRequest, opts ...grpc.CallOption) (*SetGroupPermissionsResponse, error) }
func NewRPCClient ¶
func NewRPCClient(cc *grpc.ClientConn) RPCClient
type RPCServer ¶
type RPCServer interface { Login(context.Context, *LoginRequest) (*LoginResponse, error) Logout(context.Context, *LogoutRequest) (*LogoutResponse, error) IsAuthenticated(context.Context, *IsAuthenticatedRequest) (*IsAuthenticatedResponse, error) Subject(context.Context, *SubjectRequest) (*SubjectResponse, error) IsGranted(context.Context, *IsGrantedRequest) (*IsGrantedResponse, error) BelongsTo(context.Context, *BelongsToRequest) (*BelongsToResponse, error) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) ModifyUser(context.Context, *ModifyUserRequest) (*ModifyUserResponse, error) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) ListUserPermissions(context.Context, *ListUserPermissionsRequest) (*ListUserPermissionsResponse, error) SetUserPermissions(context.Context, *SetUserPermissionsRequest) (*SetUserPermissionsResponse, error) ListUserGroups(context.Context, *ListUserGroupsRequest) (*ListUserGroupsResponse, error) SetUserGroups(context.Context, *SetUserGroupsRequest) (*SetUserGroupsResponse, error) RegisterPermissions(context.Context, *RegisterPermissionsRequest) (*RegisterPermissionsResponse, error) ListPermissions(context.Context, *ListPermissionsRequest) (*ListPermissionsResponse, error) GetPermission(context.Context, *GetPermissionRequest) (*GetPermissionResponse, error) CreateGroup(context.Context, *CreateGroupRequest) (*CreateGroupResponse, error) ModifyGroup(context.Context, *ModifyGroupRequest) (*ModifyGroupResponse, error) GetGroup(context.Context, *GetGroupRequest) (*GetGroupResponse, error) ListGroups(context.Context, *ListGroupsRequest) (*ListGroupsResponse, error) DeleteGroup(context.Context, *DeleteGroupRequest) (*DeleteGroupResponse, error) ListGroupPermissions(context.Context, *ListGroupPermissionsRequest) (*ListGroupPermissionsResponse, error) SetGroupPermissions(context.Context, *SetGroupPermissionsRequest) (*SetGroupPermissionsResponse, error) }
type RegisterPermissionsRequest ¶
type RegisterPermissionsRequest struct {
Permissions []string `protobuf:"bytes,1,rep,name=permissions" json:"permissions,omitempty"`
}
func (*RegisterPermissionsRequest) Descriptor ¶
func (*RegisterPermissionsRequest) Descriptor() ([]byte, []int)
func (*RegisterPermissionsRequest) ProtoMessage ¶
func (*RegisterPermissionsRequest) ProtoMessage()
func (*RegisterPermissionsRequest) Reset ¶
func (m *RegisterPermissionsRequest) Reset()
func (*RegisterPermissionsRequest) String ¶
func (m *RegisterPermissionsRequest) String() string
type RegisterPermissionsResponse ¶
type RegisterPermissionsResponse struct { Created int64 `protobuf:"varint,1,opt,name=created" json:"created,omitempty"` Removed int64 `protobuf:"varint,2,opt,name=removed" json:"removed,omitempty"` Untouched int64 `protobuf:"varint,3,opt,name=untouched" json:"untouched,omitempty"` }
func (*RegisterPermissionsResponse) Descriptor ¶
func (*RegisterPermissionsResponse) Descriptor() ([]byte, []int)
func (*RegisterPermissionsResponse) ProtoMessage ¶
func (*RegisterPermissionsResponse) ProtoMessage()
func (*RegisterPermissionsResponse) Reset ¶
func (m *RegisterPermissionsResponse) Reset()
func (*RegisterPermissionsResponse) String ¶
func (m *RegisterPermissionsResponse) String() string
type SecurityContext ¶
type SecurityContext interface { context.Context oauth2.TokenSource // Subject ... Subject() (Subject, bool) // AccessToken ... AccessToken() (mnemosynerpc.AccessToken, bool) }
SecurityContext ....
Example ¶
token := mnemosynerpc.NewAccessToken([]byte("0000000001"), []byte("some hash")) subject := Subject{ ID: 1, Username: "j.kowalski@gmail.com", } ctx := NewSubjectContext(context.Background(), subject) ctx = mnemosynerpc.NewAccessTokenContext(ctx, token) sctx := NewSecurityContext(ctx) var ( t *oauth2.Token s Subject err error ok bool ) if t, err = sctx.Token(); err != nil { fmt.Printf("unexpected error: %s", err.Error()) } else { fmt.Println(t.AccessToken) } if s, ok = sctx.Subject(); ok { fmt.Println(s.ID) fmt.Println(s.Username) }
Output: 0000000001some hash 1 j.kowalski@gmail.com
func NewSecurityContext ¶
func NewSecurityContext(ctx context.Context) SecurityContext
NewSecurityContext allocates new context.
type SetGroupPermissionsRequest ¶
type SetGroupPermissionsRequest struct { GroupId int64 `protobuf:"varint,1,opt,name=group_id,json=groupId" json:"group_id,omitempty"` Permissions []string `protobuf:"bytes,2,rep,name=permissions" json:"permissions,omitempty"` }
func (*SetGroupPermissionsRequest) Descriptor ¶
func (*SetGroupPermissionsRequest) Descriptor() ([]byte, []int)
func (*SetGroupPermissionsRequest) ProtoMessage ¶
func (*SetGroupPermissionsRequest) ProtoMessage()
func (*SetGroupPermissionsRequest) Reset ¶
func (m *SetGroupPermissionsRequest) Reset()
func (*SetGroupPermissionsRequest) String ¶
func (m *SetGroupPermissionsRequest) String() string
type SetGroupPermissionsResponse ¶
type SetGroupPermissionsResponse struct { Created int64 `protobuf:"varint,1,opt,name=created" json:"created,omitempty"` Removed int64 `protobuf:"varint,2,opt,name=removed" json:"removed,omitempty"` Untouched int64 `protobuf:"varint,3,opt,name=untouched" json:"untouched,omitempty"` }
func (*SetGroupPermissionsResponse) Descriptor ¶
func (*SetGroupPermissionsResponse) Descriptor() ([]byte, []int)
func (*SetGroupPermissionsResponse) ProtoMessage ¶
func (*SetGroupPermissionsResponse) ProtoMessage()
func (*SetGroupPermissionsResponse) Reset ¶
func (m *SetGroupPermissionsResponse) Reset()
func (*SetGroupPermissionsResponse) String ¶
func (m *SetGroupPermissionsResponse) String() string
type SetUserGroupsRequest ¶
type SetUserGroupsRequest struct { UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` Groups []int64 `protobuf:"varint,2,rep,name=groups" json:"groups,omitempty"` }
func (*SetUserGroupsRequest) Descriptor ¶
func (*SetUserGroupsRequest) Descriptor() ([]byte, []int)
func (*SetUserGroupsRequest) ProtoMessage ¶
func (*SetUserGroupsRequest) ProtoMessage()
func (*SetUserGroupsRequest) Reset ¶
func (m *SetUserGroupsRequest) Reset()
func (*SetUserGroupsRequest) String ¶
func (m *SetUserGroupsRequest) String() string
type SetUserGroupsResponse ¶
type SetUserGroupsResponse struct { Created int64 `protobuf:"varint,1,opt,name=created" json:"created,omitempty"` Removed int64 `protobuf:"varint,2,opt,name=removed" json:"removed,omitempty"` Untouched int64 `protobuf:"varint,3,opt,name=untouched" json:"untouched,omitempty"` }
func (*SetUserGroupsResponse) Descriptor ¶
func (*SetUserGroupsResponse) Descriptor() ([]byte, []int)
func (*SetUserGroupsResponse) ProtoMessage ¶
func (*SetUserGroupsResponse) ProtoMessage()
func (*SetUserGroupsResponse) Reset ¶
func (m *SetUserGroupsResponse) Reset()
func (*SetUserGroupsResponse) String ¶
func (m *SetUserGroupsResponse) String() string
type SetUserPermissionsRequest ¶
type SetUserPermissionsRequest struct { UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` Permissions []string `protobuf:"bytes,2,rep,name=permissions" json:"permissions,omitempty"` }
func (*SetUserPermissionsRequest) Descriptor ¶
func (*SetUserPermissionsRequest) Descriptor() ([]byte, []int)
func (*SetUserPermissionsRequest) ProtoMessage ¶
func (*SetUserPermissionsRequest) ProtoMessage()
func (*SetUserPermissionsRequest) Reset ¶
func (m *SetUserPermissionsRequest) Reset()
func (*SetUserPermissionsRequest) String ¶
func (m *SetUserPermissionsRequest) String() string
type SetUserPermissionsResponse ¶
type SetUserPermissionsResponse struct { Created int64 `protobuf:"varint,1,opt,name=created" json:"created,omitempty"` Removed int64 `protobuf:"varint,2,opt,name=removed" json:"removed,omitempty"` Untouched int64 `protobuf:"varint,3,opt,name=untouched" json:"untouched,omitempty"` }
func (*SetUserPermissionsResponse) Descriptor ¶
func (*SetUserPermissionsResponse) Descriptor() ([]byte, []int)
func (*SetUserPermissionsResponse) ProtoMessage ¶
func (*SetUserPermissionsResponse) ProtoMessage()
func (*SetUserPermissionsResponse) Reset ¶
func (m *SetUserPermissionsResponse) Reset()
func (*SetUserPermissionsResponse) String ¶
func (m *SetUserPermissionsResponse) String() string
type Subject ¶
type Subject struct { ID int64 `json:"id"` Username string `json:"username"` FirstName string `json:"firstName"` LastName string `json:"lastName"` IsSuperuser bool `json:"isSuperuser"` IsActive bool `json:"isActive"` IsStaff bool `json:"isStaff"` IsConfirmed bool `json:"isConfirmed"` Permissions Permissions `json:"permissions"` }
Subject is a generic object that represent anything that can be under control of charon.
type SubjectID ¶
type SubjectID string
SubjectID is globally unique identifier that in format "charon:user:<user_id>".
func SubjectIDFromInt64 ¶
SubjectIDFromInt64 allocate SessionSubjectID using given user id.
type SubjectRequest ¶
type SubjectRequest struct {
AccessToken *mnemosynerpc.AccessToken `protobuf:"bytes,1,opt,name=access_token,json=accessToken" json:"access_token,omitempty"`
}
func (*SubjectRequest) Descriptor ¶
func (*SubjectRequest) Descriptor() ([]byte, []int)
func (*SubjectRequest) GetAccessToken ¶
func (m *SubjectRequest) GetAccessToken() *mnemosynerpc.AccessToken
func (*SubjectRequest) ProtoMessage ¶
func (*SubjectRequest) ProtoMessage()
func (*SubjectRequest) Reset ¶
func (m *SubjectRequest) Reset()
func (*SubjectRequest) String ¶
func (m *SubjectRequest) String() string
type SubjectResponse ¶
type SubjectResponse struct { Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"` FirstName string `protobuf:"bytes,3,opt,name=first_name,json=firstName" json:"first_name,omitempty"` LastName string `protobuf:"bytes,4,opt,name=last_name,json=lastName" json:"last_name,omitempty"` Permissions []string `protobuf:"bytes,5,rep,name=permissions" json:"permissions,omitempty"` IsSuperuser bool `protobuf:"varint,6,opt,name=is_superuser,json=isSuperuser" json:"is_superuser,omitempty"` IsActive bool `protobuf:"varint,7,opt,name=is_active,json=isActive" json:"is_active,omitempty"` IsStuff bool `protobuf:"varint,8,opt,name=is_stuff,json=isStuff" json:"is_stuff,omitempty"` IsConfirmed bool `protobuf:"varint,9,opt,name=is_confirmed,json=isConfirmed" json:"is_confirmed,omitempty"` }
func (*SubjectResponse) Descriptor ¶
func (*SubjectResponse) Descriptor() ([]byte, []int)
func (*SubjectResponse) ProtoMessage ¶
func (*SubjectResponse) ProtoMessage()
func (*SubjectResponse) Reset ¶
func (m *SubjectResponse) Reset()
func (*SubjectResponse) String ¶
func (m *SubjectResponse) String() string
type User ¶
type User struct { Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"` FirstName string `protobuf:"bytes,3,opt,name=first_name,json=firstName" json:"first_name,omitempty"` LastName string `protobuf:"bytes,4,opt,name=last_name,json=lastName" json:"last_name,omitempty"` IsSuperuser bool `protobuf:"varint,5,opt,name=is_superuser,json=isSuperuser" json:"is_superuser,omitempty"` IsActive bool `protobuf:"varint,6,opt,name=is_active,json=isActive" json:"is_active,omitempty"` IsStaff bool `protobuf:"varint,7,opt,name=is_staff,json=isStaff" json:"is_staff,omitempty"` IsConfirmed bool `protobuf:"varint,8,opt,name=is_confirmed,json=isConfirmed" json:"is_confirmed,omitempty"` CreatedAt *google_protobuf.Timestamp `protobuf:"bytes,9,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` CreatedBy *ntypes.Int64 `protobuf:"bytes,10,opt,name=created_by,json=createdBy" json:"created_by,omitempty"` UpdatedAt *google_protobuf.Timestamp `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt" json:"updated_at,omitempty"` UpdatedBy *ntypes.Int64 `protobuf:"bytes,12,opt,name=updated_by,json=updatedBy" json:"updated_by,omitempty"` }
func (*User) Descriptor ¶
func (*User) GetCreatedAt ¶
func (m *User) GetCreatedAt() *google_protobuf.Timestamp
func (*User) GetCreatedBy ¶
func (*User) GetUpdatedAt ¶
func (m *User) GetUpdatedAt() *google_protobuf.Timestamp
func (*User) GetUpdatedBy ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()