-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a user hash function to serve as ID
- Loading branch information
1 parent
2b7f3c8
commit ac6b04d
Showing
4 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,11 @@ func (p *UserPrincipal) String() string { | |
return fmt.Sprintf("id=%q groups=%v", p.ID, p.Groups) | ||
} | ||
|
||
// Hash returns a unique string using user id,token and groups. | ||
func (p *UserPrincipal) Hash() string { | ||
This comment has been minimized.
Sorry, something went wrong.
bigkevmcd
Contributor
|
||
return fmt.Sprintf("%s/%s/%v", p.ID, p.Token(), p.Groups) | ||
} | ||
|
||
func (p *UserPrincipal) Valid() bool { | ||
if p.ID == "" && p.Token() == "" { | ||
return false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This might be better named
LockUser
as it doesn't just return the lock, but it locks it too...But this perhaps points to a nicer pattern...