1
0

feat: implement token expiration watcher

This commit is contained in:
James Houlahan
2020-04-02 14:10:15 +02:00
parent ce29d4d74e
commit 941e09079c
15 changed files with 149 additions and 93 deletions

View File

@ -243,10 +243,12 @@ func (u *User) authorizeAndUnlock() (err error) {
return nil
}
func (u *User) ReceiveAPIAuth(auth *pmapi.Auth) {
func (u *User) AuthorizeWithAPIAuth(auth *pmapi.Auth) {
u.lock.Lock()
defer u.lock.Unlock()
u.log.Debug("User received auth from bridge")
if auth == nil {
if err := u.logout(); err != nil {
u.log.WithError(err).Error("Failed to logout user after receiving empty auth from API")