File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ export const authCodeFlowConfig: AuthConfig = {
9
9
? '/#/index.html'
10
10
: '/index.html' ) ,
11
11
12
+ silentRefreshRedirectUri : `${ window . location . origin } /silent-refresh.html` ,
13
+
12
14
// The SPA's id. The SPA is registerd with this id at the auth-server
13
15
// clientId: 'server.code',
14
16
clientId : 'spa' ,
Original file line number Diff line number Diff line change @@ -28,6 +28,17 @@ <h2>Login with Implicit Flow</h2>
28
28
</ div >
29
29
</ div >
30
30
31
+ < div class ="panel panel-default ">
32
+ < div class ="panel-body ">
33
+ < h2 > Login with Implicit Flow in popup</ h2 >
34
+ < p >
35
+ < button class ="btn btn-default " (click) ="loginImplicitInPopup() "> Login</ button >
36
+ < button class ="btn btn-default " (click) ="logout() "> Logout</ button >
37
+ </ p >
38
+ < b > Username/Password:</ b > max/geheim
39
+ </ div >
40
+ </ div >
41
+
31
42
< div class ="panel panel-default ">
32
43
< div class ="panel-body ">
33
44
< h2 > Login with Code Flow</ h2 >
@@ -39,6 +50,17 @@ <h2>Login with Code Flow</h2>
39
50
</ div >
40
51
</ div >
41
52
53
+ < div class ="panel panel-default ">
54
+ < div class ="panel-body ">
55
+ < h2 > Login with Code Flow in popup</ h2 >
56
+ < p >
57
+ < button class ="btn btn-default " (click) ="loginCodeInPopup() "> Login</ button >
58
+ < button class ="btn btn-default " (click) ="logout() "> Logout</ button >
59
+ </ p >
60
+ < b > Username/Password:</ b > alice/alice
61
+ </ div >
62
+ </ div >
63
+
42
64
< div class ="panel panel-default ">
43
65
< div class ="panel-body ">
44
66
< p >
Original file line number Diff line number Diff line change @@ -34,6 +34,19 @@ export class HomeComponent implements OnInit {
34
34
// the parameter here is optional. It's passed around and can be used after logging in
35
35
}
36
36
37
+ async loginImplicitInPopup ( ) {
38
+
39
+ // Tweak config for implicit flow
40
+ this . oauthService . configure ( authConfig ) ;
41
+ await this . oauthService . loadDiscoveryDocument ( ) ;
42
+ sessionStorage . setItem ( 'flow' , 'implicit' ) ;
43
+
44
+ this . oauthService . initLoginFlowInPopup ( ) . then ( ( ) => {
45
+ this . loadUserProfile ( ) ;
46
+ } ) ;
47
+ // the parameter here is optional. It's passed around and can be used after logging in
48
+ }
49
+
37
50
async loginCode ( ) {
38
51
// Tweak config for code flow
39
52
this . oauthService . configure ( authCodeFlowConfig ) ;
@@ -44,6 +57,17 @@ export class HomeComponent implements OnInit {
44
57
// the parameter here is optional. It's passed around and can be used after logging in
45
58
}
46
59
60
+ async loginCodeInPopup ( ) {
61
+ // Tweak config for code flow
62
+ this . oauthService . configure ( authCodeFlowConfig ) ;
63
+ await this . oauthService . loadDiscoveryDocument ( ) ;
64
+ sessionStorage . setItem ( 'flow' , 'code' ) ;
65
+
66
+ this . oauthService . initLoginFlowInPopup ( ) . then ( ( ) => {
67
+ this . loadUserProfile ( ) ;
68
+ } ) ;
69
+ }
70
+
47
71
logout ( ) {
48
72
this . oauthService . logOut ( ) ;
49
73
}
You can’t perform that action at this time.
0 commit comments