Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IRMA
Github mirrors
irmago
Commits
4d652001
Commit
4d652001
authored
Jun 15, 2021
by
Sietse Ringers
Browse files
feat: don't call time.Now() twice in succession in generating keyshare authentication JWT
parent
77d8ef0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
internal/keysharecore/operations.go
View file @
4d652001
...
...
@@ -65,11 +65,12 @@ func (c *Core) ValidatePin(secrets UserSecrets, pin string) (string, error) {
// Generate jwt token
id
:=
s
.
id
()
t
:=
time
.
Now
()
token
:=
jwt
.
NewWithClaims
(
jwt
.
SigningMethodRS256
,
jwt
.
MapClaims
{
"iss"
:
c
.
jwtIssuer
,
"sub"
:
"auth_tok"
,
"iat"
:
t
ime
.
Now
()
.
Unix
(),
"exp"
:
t
ime
.
Now
()
.
Add
(
time
.
Duration
(
c
.
jwtPinExpiry
)
*
time
.
Second
)
.
Unix
(),
"iat"
:
t
.
Unix
(),
"exp"
:
t
.
Add
(
time
.
Duration
(
c
.
jwtPinExpiry
)
*
time
.
Second
)
.
Unix
(),
"token_id"
:
base64
.
StdEncoding
.
EncodeToString
(
id
[
:
]),
})
token
.
Header
[
"kid"
]
=
c
.
jwtPrivateKeyID
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment