Documentation ¶
Index ¶
- Constants
- Variables
- func Allow(ctx context.Context, role, project, resource, verbs string) (bool, error)
- func ChangePassword(ctx context.Context, changerRole, changerName string, a *rbacframe.Account) error
- func CountFailure(key string)
- func Enabled() bool
- func GetPrivateKey() (*rsa.PrivateKey, error)
- func Init()
- func IsBanned(key string) bool
- func PublicKey() string
- type Client
- type EmbeddedAuthenticator
Constants ¶
View Source
const ( MaxAttempts = 2 BlockInterval = 1 * time.Hour )
View Source
const ( RootName = "root" InitPassword = "SC_INIT_ROOT_PASSWORD" PubFilePath = "rbac_rsa_public_key_file" )
View Source
const (
ResourceAccount = "account"
)
Variables ¶
View Source
var ( ErrEmptyCurrentPassword = errors.New("current password should not be empty") ErrNoPermChangeAccount = errors.New("can not change other account password") ErrWrongPassword = errors.New("current pwd is wrong") ErrSamePassword = errors.New("the password can not be same as old one") ErrEmptyPassword = errors.New("empty password") )
View Source
var BanTime = 1 * time.Hour
Functions ¶
func ChangePassword ¶
func CountFailure ¶
func CountFailure(key string)
CountFailure can cause a client banned it use time/rate to allow certainty failure, but will ban client if rate limiter can not accept failures
func GetPrivateKey ¶
func GetPrivateKey() (*rsa.PrivateKey, error)
GetPrivateKey return rsa key instance
func Init ¶
func Init()
Init decide whether enable rbac function and save root account to db if db has root account, abort creating.
Types ¶
type Client ¶
type Client struct { Key string Banned bool ReleaseAt time.Time //at this time client can be allow to attempt to do something // contains filtered or unexported fields }
func BannedList ¶
func BannedList() []*Client
type EmbeddedAuthenticator ¶
type EmbeddedAuthenticator struct { }
EmbeddedAuthenticator is sc default auth plugin, RBAC data is persisted in etcd
func (*EmbeddedAuthenticator) Authenticate ¶
func (a *EmbeddedAuthenticator) Authenticate(ctx context.Context, tokenStr string) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.