forked from TrueCloudLab/frostfs-api-go
service: make RequestData to provide BearerTokenSource interface
This commit is contained in:
parent
ce5264a479
commit
3f7d3f8a86
6 changed files with 73 additions and 0 deletions
|
@ -12,6 +12,10 @@ type signedBearerToken struct {
|
|||
BearerToken
|
||||
}
|
||||
|
||||
type bearerMsgWrapper struct {
|
||||
*BearerTokenMsg
|
||||
}
|
||||
|
||||
const fixedBearerTokenDataSize = 0 +
|
||||
refs.OwnerIDSize +
|
||||
8
|
||||
|
@ -124,3 +128,29 @@ func (m *BearerTokenMsg) SetOwnerKey(v []byte) {
|
|||
func (m *BearerTokenMsg) SetSignature(v []byte) {
|
||||
m.Signature = v
|
||||
}
|
||||
|
||||
func wrapBearerTokenMsg(msg *BearerTokenMsg) bearerMsgWrapper {
|
||||
return bearerMsgWrapper{
|
||||
BearerTokenMsg: msg,
|
||||
}
|
||||
}
|
||||
|
||||
// ExpirationEpoch returns the result of ValidUntil field getter.
|
||||
//
|
||||
// If message is nil, 0 returns.
|
||||
func (s bearerMsgWrapper) ExpirationEpoch() uint64 {
|
||||
if s.BearerTokenMsg != nil {
|
||||
return s.GetValidUntil()
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// SetExpirationEpoch passes argument to ValidUntil field setter.
|
||||
//
|
||||
// If message is nil, nothing changes.
|
||||
func (s bearerMsgWrapper) SetExpirationEpoch(v uint64) {
|
||||
if s.BearerTokenMsg != nil {
|
||||
s.SetValidUntil(v)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue