Commit 910ec7b 1 parent a7cabab commit 910ec7b Copy full SHA for 910ec7b
File tree 5 files changed +40
-10
lines changed
AzureFunctions.AngularClient/src/app
5 files changed +40
-10
lines changed Original file line number Diff line number Diff line change @@ -64,10 +64,13 @@ export class AadRegistrationComponent extends FunctionAppContextComponent implem
64
64
}
65
65
66
66
ngOnInit ( ) {
67
- this . _portalService . getStartupInfo ( ) . first ( ) . subscribe ( info => {
68
- this . graphToken = info . graphToken ;
69
- this . setModel ( ) ;
70
- } ) ;
67
+ this . _portalService . getAdToken ( 'graph' )
68
+ . subscribe ( tokenData => {
69
+ this . graphToken = tokenData . result . token ;
70
+ } ,
71
+ err => {
72
+ this . processError ( err , "Error retrieving graph yoken" )
73
+ } ) ;
71
74
}
72
75
73
76
openAuth ( ) {
Original file line number Diff line number Diff line change 650
650
public static keysDialog_getFunctionUrl : string = "keysDialog_getFunctionUrl" ;
651
651
public static keysDialog_key : string = "keysDialog_key" ;
652
652
public static keysDialog_url : string = "keysDialog_url" ;
653
- public static keysDialog_domain : string = "keysDialog_domain" ;
654
- public static keysDialog_warning : string = "keysDialog_warning" ;
655
- public static keysDialog_noHttps : string = "keysDialog_noHttps" ;
656
653
public static downloadFunctionAppContent : string = "downloadFunctionAppContent" ;
657
654
public static functionKeys_renewConfirmation : string = "functionKeys_renewConfirmation" ;
658
655
public static emptyBrowse : string = "emptyBrowse" ;
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ export interface StartupInfo {
22
22
acceptLanguage : string ;
23
23
effectiveLocale : string ;
24
24
resourceId : string ;
25
- graphToken : string ;
26
25
theme : string ;
27
26
crmInfo ?: CrmInfo ;
28
27
armEndpoint ?: string ;
@@ -198,3 +197,9 @@ export enum PartSize {
198
197
*/
199
198
Custom = 99 ,
200
199
}
200
+
201
+
202
+ export interface TokenResponse {
203
+ tokenType : 'graph' | 'azureTfsApi' ;
204
+ token : string
205
+ }
Original file line number Diff line number Diff line change @@ -143,6 +143,33 @@ export class PortalService {
143
143
this . postMessage ( Verbs . openBladeCollectorInputs , JSON . stringify ( payload ) ) ;
144
144
return this . operationStream
145
145
. filter ( o => o . operationId === operationId )
146
+ . first ( )
147
+ . switchMap ( ( o : DataMessage < BladeResult > ) => {
148
+ if ( o . data . status === 'success' ) {
149
+ return Observable . of ( o . data ) ;
150
+ } else if ( o . data . status === 'cancelled' ) {
151
+ return Observable . of ( null ) ;
152
+ } else {
153
+ return Observable . throw ( o . data ) ;
154
+ }
155
+ } ) ;
156
+ }
157
+
158
+ getAdToken ( tokenType : 'graph' | 'azureTfsApi' ) {
159
+ this . logAction ( 'portal-service' , `get-ad-token: ${ tokenType } ` , null ) ;
160
+ const operationId = Guid . newGuid ( ) ;
161
+
162
+ const payload = {
163
+ operationId : operationId ,
164
+ data : {
165
+ tokenType : tokenType
166
+ }
167
+ }
168
+
169
+ this . postMessage ( 'get-ad-token' , JSON . stringify ( payload ) ) ;
170
+ return this . operationStream
171
+ . filter ( o => o . operationId === operationId )
172
+ . first ( )
146
173
. switchMap ( ( o : DataMessage < BladeResult > ) => {
147
174
if ( o . data . status === 'success' ) {
148
175
return Observable . of ( o . data ) ;
Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ export class UserService {
43
43
44
44
this . _startupInfo = {
45
45
token : null ,
46
- graphToken : null ,
47
46
subscriptions : null ,
48
47
sessionId : null ,
49
48
acceptLanguage : null ,
@@ -131,7 +130,6 @@ export class UserService {
131
130
. subscribe ( r => {
132
131
const info = {
133
132
token : token ,
134
- graphToken : this . _startupInfo . graphToken ,
135
133
subscriptions : r . subs ,
136
134
sessionId : this . _startupInfo . sessionId ,
137
135
acceptLanguage : this . _startupInfo . acceptLanguage ,
You can’t perform that action at this time.
0 commit comments