Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
server
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
m-team
oidc
mytoken
server
Commits
dd6500a7
Commit
dd6500a7
authored
3 years ago
by
Gabriel Zachmann
Browse files
Options
Downloads
Patches
Plain Diff
fix bug where mytokens that are not yet valid cannot be created
parent
19c16b2d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
internal/endpoints/token/mytoken/polling/pollingEndpoint.go
+1
-1
1 addition, 1 deletion
internal/endpoints/token/mytoken/polling/pollingEndpoint.go
shared/mytoken/pkg/mytoken.go
+20
-4
20 additions, 4 deletions
shared/mytoken/pkg/mytoken.go
with
22 additions
and
5 deletions
CHANGELOG.md
+
1
−
0
View file @
dd6500a7
...
...
@@ -36,6 +36,7 @@
-
Fixed PKCE code verifier length.
-
Fixed Datetimepicker issues on consent page.
-
Fixed response type if an (oidc) error occures on the redirect step of the authorization code flow.
-
Fixed a bug where mytokens that are not yet valid could not be created
## mytoken 0.3.2
...
...
This diff is collapsed.
Click to expand it.
internal/endpoints/token/mytoken/polling/pollingEndpoint.go
+
1
−
1
View file @
dd6500a7
...
...
@@ -65,7 +65,7 @@ func handlePollingCode(req response.PollingCodeRequest, networkData api.ClientMe
Response
:
api
.
ErrorAuthorizationPending
,
}
}
mt
,
err
:=
mytoken
.
ParseJWT
(
token
)
mt
,
err
:=
mytoken
.
ParseJWT
WithoutClaimsValidation
(
token
)
if
err
!=
nil
{
log
.
Errorf
(
"%s"
,
errorfmt
.
Full
(
err
))
return
model
.
ErrorToInternalServerErrorResponse
(
err
)
...
...
This diff is collapsed.
Click to expand it.
shared/mytoken/pkg/mytoken.go
+
20
−
4
View file @
dd6500a7
...
...
@@ -255,15 +255,31 @@ func (mt *Mytoken) ToJWT() (string, error) {
return
mt
.
jwt
,
nil
}
var
err
error
mt
.
jwt
,
err
=
jwt
.
NewWithClaims
(
jwt
.
GetSigningMethod
(
config
.
Get
()
.
Signing
.
Alg
),
mt
)
.
SignedString
(
jws
.
GetPrivateKey
())
mt
.
jwt
,
err
=
jwt
.
NewWithClaims
(
jwt
.
GetSigningMethod
(
config
.
Get
()
.
Signing
.
Alg
),
mt
,
)
.
SignedString
(
jws
.
GetPrivateKey
())
return
mt
.
jwt
,
errors
.
WithStack
(
err
)
}
// ParseJWT parses a token string into a Mytoken
func
ParseJWT
(
token
string
)
(
*
Mytoken
,
error
)
{
tok
,
err
:=
jwt
.
ParseWithClaims
(
token
,
&
Mytoken
{},
func
(
t
*
jwt
.
Token
)
(
interface
{},
error
)
{
return
jws
.
GetPublicKey
(),
nil
})
return
parseJWT
(
token
,
false
)
}
// ParseJWTWithoutClaimsValidation parses a token string into a Mytoken
func
ParseJWTWithoutClaimsValidation
(
token
string
)
(
*
Mytoken
,
error
)
{
return
parseJWT
(
token
,
true
)
}
func
parseJWT
(
token
string
,
skipCalimsValidation
bool
)
(
*
Mytoken
,
error
)
{
parser
:=
jwt
.
Parser
{
SkipClaimsValidation
:
skipCalimsValidation
,
}
tok
,
err
:=
parser
.
ParseWithClaims
(
token
,
&
Mytoken
{},
func
(
t
*
jwt
.
Token
)
(
interface
{},
error
)
{
return
jws
.
GetPublicKey
(),
nil
},
)
if
err
!=
nil
{
return
nil
,
errors
.
WithStack
(
err
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment