@@ -11,10 +11,10 @@ import SessionMonitor from './SessionMonitor';
1111
1212export default class UserManager extends OidcClient {
1313 constructor ( settings = { } ,
14- SilentRenewServiceCtor = SilentRenewService ,
15- SessionMonitorCtor = SessionMonitor
14+ SilentRenewServiceCtor = SilentRenewService ,
15+ SessionMonitorCtor = SessionMonitor
1616 ) {
17-
17+
1818 if ( ! ( settings instanceof UserManagerSettings ) ) {
1919 settings = new UserManagerSettings ( settings ) ;
2020 }
@@ -111,8 +111,8 @@ export default class UserManager extends OidcClient {
111111 args . redirect_uri = url ;
112112 args . prompt = "none" ;
113113
114- return this . _signin ( args , this . _iframeNavigator , {
115- startUrl : url ,
114+ return this . _signin ( args , this . _iframeNavigator , {
115+ startUrl : url ,
116116 silentRequestTimeout : args . silentRequestTimeout || this . settings . silentRequestTimeout
117117 } ) ;
118118 }
@@ -121,6 +121,37 @@ export default class UserManager extends OidcClient {
121121 return this . _signinCallback ( url , this . _iframeNavigator ) ;
122122 }
123123
124+ silentQueryCurrentSignedInSession ( args = { } ) {
125+ Log . info ( "UserManager.silentQueryCurrentSignedInSession" ) ;
126+
127+ let url = args . redirect_uri || this . settings . silent_redirect_uri ;
128+ if ( ! url ) {
129+ Log . error ( "No silent_redirect_uri configured" ) ;
130+ return Promise . reject ( new Error ( "No silent_redirect_uri configured" ) ) ;
131+ }
132+
133+ args . redirect_uri = url ;
134+ args . prompt = "none" ;
135+ args . response_type = "id_token" ;
136+ args . scope = "openid" ;
137+
138+ return this . _signinStart ( args , this . _iframeNavigator , {
139+ startUrl : url ,
140+ silentRequestTimeout : args . silentRequestTimeout || this . settings . silentRequestTimeout
141+ } ) . then ( navResponse => {
142+ return this . processSigninResponse ( navResponse . url ) . then ( signinResponse => {
143+ Log . info ( "got signin response" ) ;
144+
145+ if ( signinResponse . session_state && signinResponse . profile . sub ) {
146+ return {
147+ session_state : signinResponse . session_state ,
148+ sub : signinResponse . profile . sub
149+ } ;
150+ }
151+ } ) ;
152+ } ) ;
153+ }
154+
124155 _signin ( args , navigator , navigatorParams = { } ) {
125156 Log . info ( "_signin" ) ;
126157 return this . _signinStart ( args , navigator , navigatorParams ) . then ( navResponse => {
@@ -163,10 +194,10 @@ export default class UserManager extends OidcClient {
163194 return Promise . reject ( new Error ( "No popup_redirect_uri or redirect_uri configured" ) ) ;
164195 }
165196
166- return this . _signout ( args , this . _popupNavigator , {
197+ return this . _signout ( args , this . _popupNavigator , {
167198 startUrl : url ,
168199 popupWindowFeatures : args . popupWindowFeatures || this . settings . popupWindowFeatures ,
169- popupWindowTarget : args . popupWindowTarget || this . settings . popupWindowTarget
200+ popupWindowTarget : args . popupWindowTarget || this . settings . popupWindowTarget
170201 } ) ;
171202 }
172203 signoutRedirectCallback ( url ) {
0 commit comments