Documentation ¶
Index ¶
- func DeclineConsentByState(rlog log.Ext1FieldLogger, tx *sqlx.Tx, state *state.State) error
- func DeleteTransferCodeByState(rlog log.Ext1FieldLogger, tx *sqlx.Tx, state *state.State) error
- func LinkPollingCodeToMT(rlog log.Ext1FieldLogger, tx *sqlx.Tx, pollingCode, jwt string, mID mtid.MTID) error
- func LinkPollingCodeToSSHKey(rlog log.Ext1FieldLogger, tx *sqlx.Tx, pollingCode, sshKeyHash string) error
- func PopTokenForTransferCode(rlog log.Ext1FieldLogger, tx *sqlx.Tx, pollingCode string, ...) (jwt string, err error)
- type ShortToken
- func (pt ShortToken) Delete(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
- func (pt *ShortToken) ID() string
- func (pt *ShortToken) JWT(rlog log.Ext1FieldLogger, tx *sqlx.Tx) (jwt string, valid bool, err error)
- func (pt *ShortToken) SetJWT(jwt string, mID mtid.MTID) (err error)
- func (pt ShortToken) Store(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
- func (pt ShortToken) String() string
- func (pt ShortToken) Token() string
- func (pt ShortToken) Update(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
- type TransferCode
- func (pt TransferCode) Delete(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
- func (tc TransferCode) GetRevokeJWT(rlog log.Ext1FieldLogger, tx *sqlx.Tx) (bool, error)
- func (pt *TransferCode) ID() string
- func (pt *TransferCode) JWT(rlog log.Ext1FieldLogger, tx *sqlx.Tx) (jwt string, valid bool, err error)
- func (pt *TransferCode) SetJWT(jwt string, mID mtid.MTID) (err error)
- func (tc TransferCode) Store(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
- func (pt TransferCode) String() string
- func (pt TransferCode) Token() string
- func (pt TransferCode) Update(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
- type TransferCodeStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeclineConsentByState ¶
DeclineConsentByState updates the polling code attribute after the consent has been declined
func DeleteTransferCodeByState ¶
DeleteTransferCodeByState deletes a polling code
func LinkPollingCodeToMT ¶
func LinkPollingCodeToMT(rlog log.Ext1FieldLogger, tx *sqlx.Tx, pollingCode, jwt string, mID mtid.MTID) error
LinkPollingCodeToMT links a pollingCode to a Mytoken
func LinkPollingCodeToSSHKey ¶ added in v0.4.0
func LinkPollingCodeToSSHKey(rlog log.Ext1FieldLogger, tx *sqlx.Tx, pollingCode, sshKeyHash string) error
LinkPollingCodeToSSHKey links a pollingCode to an ssh public key
func PopTokenForTransferCode ¶
func PopTokenForTransferCode( rlog log.Ext1FieldLogger, tx *sqlx.Tx, pollingCode string, clientMetadata api.ClientMetaData, ) ( jwt string, err error, )
PopTokenForTransferCode returns the decrypted token for a polling code and then deletes the entry
Types ¶
type ShortToken ¶
type ShortToken struct {
// contains filtered or unexported fields
}
ShortToken holds database information of a short token
func NewShortToken ¶
func NewShortToken(jwt string, mID mtid.MTID) (*ShortToken, error)
NewShortToken creates a new short token from the given jwt of a normal Mytoken
func ParseShortToken ¶
func ParseShortToken(token string) *ShortToken
ParseShortToken creates a new short token from a short token string
func (ShortToken) Delete ¶
func (pt ShortToken) Delete(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
Delete deletes the proxyToken from the database, it does not delete the linked Mytoken, the jwt should have been retrieved earlier and the Mytoken if desired be revoked separately
func (*ShortToken) JWT ¶
func (pt *ShortToken) JWT(rlog log.Ext1FieldLogger, tx *sqlx.Tx) (jwt string, valid bool, err error)
JWT returns the decrypted jwt that is linked to this proxyToken
func (ShortToken) Store ¶
func (pt ShortToken) Store(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
Store stores the proxyToken
type TransferCode ¶
type TransferCode struct { Attributes transferCodeAttributes // contains filtered or unexported fields }
TransferCode is a type used to transfer a token
func CreatePollingCode ¶
func CreatePollingCode(pollingCode string, responseType model.ResponseType, maxTokenLen int) *TransferCode
CreatePollingCode creates a polling code
func NewTransferCode ¶
func NewTransferCode(jwt string, mID mtid.MTID, newMT bool, responseType model.ResponseType) (*TransferCode, error)
NewTransferCode creates a new TransferCode for the passed jwt
func ParseTransferCode ¶
func ParseTransferCode(token string) *TransferCode
ParseTransferCode creates a new transfer code from a transfer code string
func (TransferCode) Delete ¶
func (pt TransferCode) Delete(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
Delete deletes the proxyToken from the database, it does not delete the linked Mytoken, the jwt should have been retrieved earlier and the Mytoken if desired be revoked separately
func (TransferCode) GetRevokeJWT ¶
func (tc TransferCode) GetRevokeJWT(rlog log.Ext1FieldLogger, tx *sqlx.Tx) (bool, error)
GetRevokeJWT returns a bool indicating if the linked jwt should also be revoked when this TransferCode is revoked or not
func (*TransferCode) JWT ¶
func (pt *TransferCode) JWT(rlog log.Ext1FieldLogger, tx *sqlx.Tx) (jwt string, valid bool, err error)
JWT returns the decrypted jwt that is linked to this proxyToken
func (TransferCode) Store ¶
func (tc TransferCode) Store(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error
Store stores the TransferCode in the database
type TransferCodeStatus ¶
type TransferCodeStatus struct { Found bool `db:"found"` Expired bool `db:"expired"` ResponseType model.ResponseType `db:"response_type"` ConsentDeclined db.BitBool `db:"consent_declined"` MaxTokenLen *int `db:"max_token_len"` SSHKeyFingerprint db.NullString `db:"ssh_key_fp"` }
TransferCodeStatus holds information about the status of a polling code
func CheckTransferCode ¶
func CheckTransferCode(rlog log.Ext1FieldLogger, tx *sqlx.Tx, pollingCode string) (TransferCodeStatus, error)
CheckTransferCode checks the passed polling code in the database