Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Line v2.1 OIDC provider and update related conf… #4240

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion embedx/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@
"linkedin",
"linkedin_v2",
"lark",
"x"
"x",
"line"
],
"examples": ["google"]
},
Expand Down
1 change: 1 addition & 0 deletions selfservice/strategy/oidc/provider_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ var supportedProviders = map[string]func(config *Configuration, reg Dependencies
"patreon": NewProviderPatreon,
"lark": NewProviderLark,
"x": NewProviderX,
"line": NewProviderLineV21,
"jackson": NewProviderJackson,
}

Expand Down
41 changes: 41 additions & 0 deletions selfservice/strategy/oidc/provider_line_2_1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

package oidc

import (
"context"

"golang.org/x/oauth2"
)

type ProviderLineV21 struct {
*ProviderGenericOIDC
}

func NewProviderLineV21(
config *Configuration,
reg Dependencies,
) Provider {
return &ProviderLineV21{
&ProviderGenericOIDC{
config: config,
reg: reg,
},
}
}

func (g *ProviderLineV21) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error) {
o, err := g.ProviderGenericOIDC.OAuth2(ctx)
Fixed Show fixed Hide fixed

if err != nil {
return nil, err
}
// Line login requires adding id_token_key_type=JWK when getting the token in order to issue an HS256 token.
opts = append(opts, oauth2.SetAuthURLParam("id_token_key_type", "JWK"))

token, err := o.Exchange(ctx, code, opts...)

return token, err

}
1 change: 1 addition & 0 deletions selfservice/strategy/oidc/provider_private_net_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func TestProviderPrivateIP(t *testing.T) {
// Yandex uses a fixed token URL and does not use the issuer.
// NetID uses a fixed token URL and does not use the issuer.
// X uses a fixed token URL and userinfoRL and does not use the issuer value.
// Line v2.1 uses a fixed token URL and does not use the issuer.
} {
t.Run(fmt.Sprintf("case=%d", k), func(t *testing.T) {
p := tc.p(tc.c)
Expand Down
Loading