@@ -10,13 +10,15 @@ import {
10
10
Configuration ,
11
11
INetworkModule ,
12
12
} from '@azure/msal-common' ;
13
- import { ClientConfiguration , buildConfiguration } from '../config/ClientConfiguration' ;
13
+ import {
14
+ ClientConfiguration ,
15
+ buildConfiguration ,
16
+ } from '../config/ClientConfiguration' ;
14
17
import { CryptoOps } from '../crypto/CryptoOps' ;
15
18
import { Storage } from '../cache/Storage' ;
16
19
import { NetworkUtils } from './../utils/NetworkUtils' ;
17
20
18
21
export abstract class ClientApplication {
19
-
20
22
// Input configuration by developer/user
21
23
protected config : ClientConfiguration ;
22
24
@@ -67,31 +69,34 @@ export abstract class ClientApplication {
67
69
) ;
68
70
}
69
71
70
- /**
72
+ /**
71
73
* Creates a url for logging in a user. This will by default add scopes: openid, profile and offline_access. Also performs validation of the request parameters.
72
74
* Including any SSO parameters (account, sid, login_hint) will short circuit the authentication and allow you to retrieve a code without interaction.
73
75
* @param request
74
76
*/
75
77
async getAuthCodeUrl (
76
78
request : AuthorizationCodeUrlRequest
77
79
) : Promise < string > {
78
-
79
80
const authorizationCodeParameters : Configuration = {
80
81
authOptions : this . config . auth ,
81
82
systemOptions : {
82
- tokenRenewalOffsetSeconds : this . config . system . tokenRenewalOffsetSeconds ,
83
+ tokenRenewalOffsetSeconds : this . config . system
84
+ . tokenRenewalOffsetSeconds ,
83
85
telemetry : this . config . system . telemetry ,
84
86
} ,
85
87
loggerOptions : {
86
88
loggerCallback : this . config . system . loggerOptions . loggerCallback ,
87
- piiLoggingEnabled : this . config . system . loggerOptions . piiLoggingEnabled ,
89
+ piiLoggingEnabled : this . config . system . loggerOptions
90
+ . piiLoggingEnabled ,
88
91
} ,
89
92
cryptoInterface : this . crypto ,
90
93
networkInterface : this . networkClient ,
91
94
storageInterface : this . storage ,
92
95
} ;
93
96
94
- const authorizationCodeClient = new AuthorizationCodeClient ( authorizationCodeParameters ) ;
97
+ const authorizationCodeClient = new AuthorizationCodeClient (
98
+ authorizationCodeParameters
99
+ ) ;
95
100
96
101
return authorizationCodeClient . getAuthCodeUrl ( request ) ;
97
102
}
@@ -103,40 +108,43 @@ export abstract class ClientApplication {
103
108
async acquireTokenByCode (
104
109
request : AuthorizationCodeRequest
105
110
) : Promise < string > {
106
-
107
111
const authorizationClientConfiguration : Configuration = {
108
112
authOptions : this . config . auth ,
109
113
systemOptions : {
110
- tokenRenewalOffsetSeconds : this . config . system . tokenRenewalOffsetSeconds ,
114
+ tokenRenewalOffsetSeconds : this . config . system
115
+ . tokenRenewalOffsetSeconds ,
111
116
telemetry : this . config . system . telemetry ,
112
117
} ,
113
118
loggerOptions : {
114
119
loggerCallback : this . config . system . loggerOptions . loggerCallback ,
115
- piiLoggingEnabled : this . config . system . loggerOptions . piiLoggingEnabled ,
120
+ piiLoggingEnabled : this . config . system . loggerOptions
121
+ . piiLoggingEnabled ,
116
122
} ,
117
123
cryptoInterface : this . crypto ,
118
124
networkInterface : this . networkClient ,
119
125
storageInterface : this . storage ,
120
126
} ;
121
127
122
- const authorizationCodeClient = new AuthorizationCodeClient ( authorizationClientConfiguration ) ;
128
+ const authorizationCodeClient = new AuthorizationCodeClient (
129
+ authorizationClientConfiguration
130
+ ) ;
123
131
124
132
return authorizationCodeClient . acquireToken ( request ) ;
125
133
}
126
134
127
- protected getNodeDefaultHeaders ( ) : Map < string , string > {
128
- const msalSkuHeaderKey : string = " x-client-SKU" ;
129
- const msalVersionHeaderKey : string = " x-client-VER" ;
130
- const cpuHeaderKey : string = " x-client-CPU" ;
131
- const osHeaderKey : string = " x-client-OS" ;
135
+ protected getNodeDefaultHeaders ( ) : Map < string , string > {
136
+ const msalSkuHeaderKey : string = ' x-client-SKU' ;
137
+ const msalVersionHeaderKey : string = ' x-client-VER' ;
138
+ const cpuHeaderKey : string = ' x-client-CPU' ;
139
+ const osHeaderKey : string = ' x-client-OS' ;
132
140
// const correlationId: string = "client-request_id";
133
141
// TODO will also add appName and appVersion
134
142
135
143
return new Map < string , string > ( [
136
- [ msalSkuHeaderKey , " MSAL.node" ] ,
137
- [ msalVersionHeaderKey , " 0.1.0" ] ,
138
- [ cpuHeaderKey , "" ] ,
139
- [ osHeaderKey , process . platform ]
144
+ [ msalSkuHeaderKey , ' MSAL.node' ] ,
145
+ [ msalVersionHeaderKey , ' 0.1.0' ] ,
146
+ [ cpuHeaderKey , '' ] ,
147
+ [ osHeaderKey , process . platform ] ,
140
148
] ) ;
141
149
}
142
150
}
0 commit comments