Make JwtIssuer struct private
This commit is contained in:
parent
2f6dcf3b5f
commit
100f126405
18
options.go
18
options.go
@ -171,8 +171,8 @@ func NewOptions() *Options {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JwtIssuer hold parsed JWT issuer info that's used to construct a verifier.
|
// jwtIssuer hold parsed JWT issuer info that's used to construct a verifier.
|
||||||
type JwtIssuer struct {
|
type jwtIssuer struct {
|
||||||
issuerURI string
|
issuerURI string
|
||||||
audience string
|
audience string
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ func (o *Options) Validate() error {
|
|||||||
}
|
}
|
||||||
// Configure extra issuers
|
// Configure extra issuers
|
||||||
if len(o.ExtraJwtIssuers) > 0 {
|
if len(o.ExtraJwtIssuers) > 0 {
|
||||||
var jwtIssuers []JwtIssuer
|
var jwtIssuers []jwtIssuer
|
||||||
jwtIssuers, msgs = parseJwtIssuers(o.ExtraJwtIssuers, msgs)
|
jwtIssuers, msgs = parseJwtIssuers(o.ExtraJwtIssuers, msgs)
|
||||||
for _, jwtIssuer := range jwtIssuers {
|
for _, jwtIssuer := range jwtIssuers {
|
||||||
verifier, err := newVerifierFromJwtIssuer(jwtIssuer)
|
verifier, err := newVerifierFromJwtIssuer(jwtIssuer)
|
||||||
@ -459,9 +459,9 @@ func parseSignatureKey(o *Options, msgs []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parseJwtIssuers takes in an array of strings in the form of issuer=audience
|
// parseJwtIssuers takes in an array of strings in the form of issuer=audience
|
||||||
// and parses to an array of JwtIssuer structs.
|
// and parses to an array of jwtIssuer structs.
|
||||||
func parseJwtIssuers(issuers []string, msgs []string) ([]JwtIssuer, []string) {
|
func parseJwtIssuers(issuers []string, msgs []string) ([]jwtIssuer, []string) {
|
||||||
var parsedIssuers []JwtIssuer
|
var parsedIssuers []jwtIssuer
|
||||||
for _, jwtVerifier := range issuers {
|
for _, jwtVerifier := range issuers {
|
||||||
components := strings.Split(jwtVerifier, "=")
|
components := strings.Split(jwtVerifier, "=")
|
||||||
if len(components) < 2 {
|
if len(components) < 2 {
|
||||||
@ -469,14 +469,14 @@ func parseJwtIssuers(issuers []string, msgs []string) ([]JwtIssuer, []string) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
uri, audience := components[0], strings.Join(components[1:], "=")
|
uri, audience := components[0], strings.Join(components[1:], "=")
|
||||||
parsedIssuers = append(parsedIssuers, JwtIssuer{issuerURI: uri, audience: audience})
|
parsedIssuers = append(parsedIssuers, jwtIssuer{issuerURI: uri, audience: audience})
|
||||||
}
|
}
|
||||||
return parsedIssuers, msgs
|
return parsedIssuers, msgs
|
||||||
}
|
}
|
||||||
|
|
||||||
// newVerifierFromJwtIssuer takes in issuer information in JwtIssuer info and returns
|
// newVerifierFromJwtIssuer takes in issuer information in jwtIssuer info and returns
|
||||||
// a verifier for that issuer.
|
// a verifier for that issuer.
|
||||||
func newVerifierFromJwtIssuer(jwtIssuer JwtIssuer) (*oidc.IDTokenVerifier, error) {
|
func newVerifierFromJwtIssuer(jwtIssuer jwtIssuer) (*oidc.IDTokenVerifier, error) {
|
||||||
config := &oidc.Config{
|
config := &oidc.Config{
|
||||||
ClientID: jwtIssuer.audience,
|
ClientID: jwtIssuer.audience,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user