Documentation ¶
Index ¶
- func CheckMytokensAreForSameUser(rlog log.Ext1FieldLogger, tx *sqlx.Tx, a, b interface{}) (same bool, err error)
- func CheckTokenRevoked(rlog log.Ext1FieldLogger, tx *sqlx.Tx, id mtid.MTID, seqno uint64, ...) (revoked bool, err error)
- func GetMTName(rlog log.Ext1FieldLogger, tx *sqlx.Tx, id mtid.MTID) (name db.NullString, err error)
- func GetTokenUsagesAT(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myID mtid.MTID, restrictionHash string) (usages *int64, err error)
- func GetTokenUsagesOther(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myID mtid.MTID, restrictionHash string) (usages *int64, err error)
- func IncreaseTokenUsageAT(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myID mtid.MTID, jsonRestriction []byte) error
- func IncreaseTokenUsageOther(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myID mtid.MTID, jsonRestriction []byte) error
- func MOMIDHasParent(rlog log.Ext1FieldLogger, tx *sqlx.Tx, momID string, parent mtid.MTID) (isParent bool, err error)
- func RevokeMT(rlog log.Ext1FieldLogger, tx *sqlx.Tx, id interface{}, recursive bool) error
- func SetMetadata(rlog log.Ext1FieldLogger, tx *sqlx.Tx, id mtid.MTID, meta MytokenDBMetadata) error
- func UpdateSeqNo(rlog log.Ext1FieldLogger, tx *sqlx.Tx, id mtid.MTID, seqno uint64) error
- type MytokenDBMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckMytokensAreForSameUser ¶ added in v0.6.0
func CheckMytokensAreForSameUser(rlog log.Ext1FieldLogger, tx *sqlx.Tx, a, b interface{}) ( same bool, err error, )
CheckMytokensAreForSameUser checks if two mytoken ids belong to the same user
func CheckTokenRevoked ¶
func CheckTokenRevoked(rlog log.Ext1FieldLogger, tx *sqlx.Tx, id mtid.MTID, seqno uint64, rot *api.Rotation) ( revoked bool, err error, )
CheckTokenRevoked checks if a Mytoken has been revoked. If it is a rotating mytoken and auto_revoke is enabled for this token, it might get triggered.
func GetMTName ¶ added in v0.4.0
func GetMTName(rlog log.Ext1FieldLogger, tx *sqlx.Tx, id mtid.MTID) (name db.NullString, err error)
GetMTName returns the name of the mytoken
func GetTokenUsagesAT ¶
func GetTokenUsagesAT(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myID mtid.MTID, restrictionHash string) ( usages *int64, err error, )
GetTokenUsagesAT returns how often a Mytoken was used with a specific restriction to obtain an access token
func GetTokenUsagesOther ¶
func GetTokenUsagesOther(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myID mtid.MTID, restrictionHash string) ( usages *int64, err error, )
GetTokenUsagesOther returns how often a Mytoken was used with a specific restriction to do something else than obtaining an access token
func IncreaseTokenUsageAT ¶
func IncreaseTokenUsageAT(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myID mtid.MTID, jsonRestriction []byte) error
IncreaseTokenUsageAT increases the usage count for obtaining ATs with a Mytoken and the given restriction
func IncreaseTokenUsageOther ¶
func IncreaseTokenUsageOther(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myID mtid.MTID, jsonRestriction []byte) error
IncreaseTokenUsageOther increases the usage count for other usages with a Mytoken and the given restriction
func MOMIDHasParent ¶ added in v0.10.0
func MOMIDHasParent(rlog log.Ext1FieldLogger, tx *sqlx.Tx, momID string, parent mtid.MTID) ( isParent bool, err error, )
MOMIDHasParent checks if the token for a revocation id is a child of the (potential) parent mytoken
func RevokeMT ¶
RevokeMT revokes the passed mytoken and depending on the recursive parameter also its children
func SetMetadata ¶ added in v0.10.0
func SetMetadata( rlog log.Ext1FieldLogger, tx *sqlx.Tx, id mtid.MTID, meta MytokenDBMetadata, ) error
SetMetadata adds a mytoken's metadata (capabilities, rotation, restrictions) to the database. This is needed for legacy mytokens where the metadata was not yet stored on creation. token version <0.7
func UpdateSeqNo ¶ added in v0.3.0
UpdateSeqNo updates the sequence number of a mytoken, i.e. it rotates the mytoken. Don't forget to update the encryption key
Types ¶
type MytokenDBMetadata ¶ added in v0.10.0
type MytokenDBMetadata struct { Capabilities db.NullString Rotation db.NullString Restrictions db.NullString }
MytokenDBMetadata is a type for metadata about a mytoken