Skip to content

Commit c1dd651

Browse files
authored
Add 'WithSilentAuthentication' as login option (#38)
1 parent 7bfbc1e commit c1dd651

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

idfabric/idfrabric.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ type IdentityProvider interface {
1313
// LoginOptions store the options used to customize the user experience when
1414
// calling Login on an IdentityProvider.
1515
type LoginOptions struct {
16-
Username string
17-
RedirectURL string
16+
Username string
17+
RedirectURL string
18+
SilentAuthentication bool
1819
}
1920

2021
// LoginOpt allows for customizing the login experience.
@@ -29,6 +30,19 @@ func WithLoginHint(username string) LoginOpt {
2930
}
3031
}
3132

33+
// WithSilentAuthentication specifies to the IDP that no user interaction should
34+
// occur as part of the login.
35+
//
36+
// In the context of OIDC, this option will result in the 'prompt=none' query
37+
// parameter being sent as part of the authentication request. For more details,
38+
// please see the OIDC RFC
39+
// https://openid.net/specs/openid-connect-core-1_0-final.html#AuthRequest.
40+
func WithSilentAuthentication() LoginOpt {
41+
return func(cfg *LoginOptions) {
42+
cfg.SilentAuthentication = true
43+
}
44+
}
45+
3246
// WithRedirectURL specifies landing page for the user after authenticating to
3347
// the IdentityProvider.
3448
func WithRedirectURL(url string) LoginOpt {

0 commit comments

Comments
 (0)