charon

package module
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2019 License: Apache-2.0 Imports: 2 Imported by: 10

README

Charon CircleCI

GoDoc Test Coverage Maintainability Docker Pulls pypi

Quick Start

Installation
$ go install github.com/piotrkowalczuk/charon/cmd/charond
$ go install github.com/piotrkowalczuk/charon/cmd/charonctl
Superuser
$ charonctl register -address=localhost:8080 -auth.disabled -register.superuser=true -register.username="j.snow@gmail.com" -register.password=123 -register.firstname=John -register.lastname=Snow

Example

TODO

Contribution

@TODO

Documentation

@TODO

TODO
  • Auth
    • login
    • logout
    • is authenticated
    • subject
    • is granted
    • belongs to
  • Permission
    • get
    • list
    • register
  • Group
    • get
    • list
    • modify
    • delete
    • create
    • set permissions
    • list permissions
  • User
    • get
    • list
    • modify
    • delete
    • create
    • set permissions
    • set groups
    • list permissions
    • list groups
  • Refresh Token
    • Create
    • Revoke
    • List

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

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"

	RefreshTokenCanCreate             Permission = "charon:refresh-token:can create"
	RefreshTokenCanRevokeAsStranger   Permission = "charon:refresh-token:can revoke as stranger"
	RefreshTokenCanRevokeAsOwner      Permission = "charon:refresh-token:can revoke as owner"
	RefreshTokenCanModifyAsStranger   Permission = "charon:refresh-token:can modify as stranger"
	RefreshTokenCanModifyAsOwner      Permission = "charon:refresh-token:can modify as owner"
	RefreshTokenCanRetrieveAsOwner    Permission = "charon:refresh-token:can retrieve as owner"
	RefreshTokenCanRetrieveAsStranger Permission = "charon:refresh-token:can retrieve as stranger"
)

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

Permissions is collection of permission that provide convenient API.

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) Len added in v0.18.0

func (p Permissions) Len() int

Len implements sort Interface.

func (Permissions) Less added in v0.18.0

func (p Permissions) Less(i, j int) bool

Less implements sort Interface.

func (*Permissions) Set added in v0.4.2

func (p *Permissions) Set(s string) error

Set implements flag Value interface.

func (*Permissions) String added in v0.4.2

func (p *Permissions) String() string

String implements flag Value interface.

func (Permissions) Strings

func (p Permissions) Strings() (s []string)

Strings maps Permissions into slice of strings.

func (Permissions) Swap added in v0.18.0

func (p Permissions) Swap(i, j int)

Swap implements sort Interface.

Directories

Path Synopsis
cmd
charond
Package main is server implementation of Charon auth service.
Package main is server implementation of Charon auth service.
example
internal
pb
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL