File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,6 +133,11 @@ SQLPAD_OIDC_LINK_HTML = "Sign in with OpenID"
133133
134134SQLPAD_OIDC_CLIENT_ID = " actual-client-id"
135135SQLPAD_OIDC_CLIENT_SECRET = " actual-client-secret"
136+
137+ # Authentication scope allows to customize the scope depend on the supported provider.
138+ # Default value is "openid profile email roles"
139+ SQLPAD_OIDC_SCOPE = " openid profile email roles"
140+
136141# Issuer endpoint (will vary by provider)
137142# As of version 6.4.0 the issuer endpoint is the only URL needed
138143# as long as the OIDC provider supplies .well-known endpoints
Original file line number Diff line number Diff line change @@ -90,7 +90,9 @@ async function enableOidc(config) {
9090 {
9191 passReqToCallback : true ,
9292 client,
93- params : { scope : 'openid profile email roles' } ,
93+ params : {
94+ scope : config . get ( 'oidcScope' ) || 'openid profile email roles' ,
95+ } ,
9496 } ,
9597 openidClientHandler
9698 )
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ SQLPAD_CONNECTIONS__devdbdriverid123__filename = "./test/fixtures/sales.sqlite"
2121# SQLPAD_OIDC_CLIENT_ID = CLIENT_ID
2222# SQLPAD_OIDC_CLIENT_SECRET = SECRET
2323# SQLPAD_OIDC_ISSUER = "https://dev-350224.okta.com/oauth2/default"
24+ # SQLPAD_OIDC_SCOPE = "openid profile email roles"
2425# If below are provided, the old passport-openidconnect implementation is used
2526# If the below are NOT provided, the new openid-client implementation is used
2627# SQLPAD_OIDC_AUTHORIZATION_URL = "https://dev-350224.okta.com/oauth2/default/v1/authorize"
Original file line number Diff line number Diff line change 1717 */
1818module . exports = function checkAllowedDomains ( allowedDomains , email ) {
1919 if ( allowedDomains ) {
20- const domain = email . split ( '@' ) . pop ( ) ;
21- const domains = allowedDomains . split ( ' ' ) . map ( ( domain ) => domain . trim ( ) ) ;
20+ const domain = email . split ( '@' ) . pop ( ) . toLowerCase ( ) ;
21+ const domains = allowedDomains
22+ . split ( ' ' )
23+ . map ( ( domain ) => domain . trim ( ) . toLowerCase ( ) ) ;
2224
2325 return domains . includes ( domain ) ;
2426 }
Original file line number Diff line number Diff line change @@ -358,6 +358,11 @@ const configItems = [
358358 envVar : 'SQLPAD_OIDC_LINK_HTML' ,
359359 default : 'Sign in with OpenID' ,
360360 } ,
361+ {
362+ key : 'oidcScope' ,
363+ envVar : 'SQLPAD_OIDC_SCOPE' ,
364+ default : 'openid profile email roles' ,
365+ } ,
361366 {
362367 key : 'webhookEnabled' ,
363368 envVar : 'SQLPAD_WEBHOOK_ENABLED' ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const wrap = require('../lib/wrap');
99 */
1010async function getApp ( req , res ) {
1111 const { config } = req ;
12+
1213 const currentUser =
1314 req . isAuthenticated ( ) && req . user
1415 ? {
You can’t perform that action at this time.
0 commit comments