-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Added Logger and RequestContextClasses #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@rohitnarula7176, |
lib/AccessTokenKey.ts
Outdated
@@ -2,14 +2,14 @@ namespace MSAL { | |||
export class AccessTokenKey { | |||
authority: string; | |||
clientId: string; | |||
user: User; | |||
homeObjectId: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename this to userIdentifier. this applies everywhere.
this.nonce = Utils.Guid(); | ||
} | ||
this.correlationId = Utils.Guid(); | ||
this.state = Utils.Guid(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename Utils.Guid to Utils.CreateNewGuid()
str.push('scope=' + encodeURIComponent(this.parseScope(scopes))); | ||
str.push('client_id=' + encodeURIComponent(this.clientId)); | ||
str.push('redirect_uri=' + encodeURIComponent(this.redirectUri)); | ||
str.push('state=' + encodeURIComponent(this.state)); | ||
str.push('nonce=' + encodeURIComponent(this.nonce)); | ||
if (this.extraQueryParameters) { | ||
if (this.extraQueryParameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always use curly braces for readability and avoiding bugs. applies everywhere.
static get error(): string { return "msal.error"; } | ||
static get loginRequest(): string { return "msal.login.request"; } | ||
static get loginError(): string { return "msal.login.error"; } | ||
static get renewStatus(): string { return "msal.token.renew.status"; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ this change.
lib/Logger.ts
Outdated
VERBOSE | ||
|
||
export interface ILoggerCallback { | ||
(level: LogLevel, message: string,containsPii:boolean): boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be void;
export class Logger {// Singleton Class | ||
private static _instance: Logger; | ||
private _correlationId: string; | ||
get correlationId(): string { return this._correlationId; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should have set property on the correlationID.
lib/Logger.ts
Outdated
set level(logLevel: LogLevel) { | ||
if (LogLevel[logLevel]) | ||
this._level = logLevel; | ||
else throw new Error("Provide a valid value for level. Possibles range for logLevel is 0-3"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be truly enum and not a number.
lib/RequestContext.ts
Outdated
if (RequestContext._instance) { | ||
return RequestContext._instance; | ||
} | ||
this._logger = new Logger(correlationId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add line break.
|
||
private _localCallback: ILoggerCallback; | ||
get localCallback(): ILoggerCallback { return this._localCallback; } | ||
set localCallback(localCallback: ILoggerCallback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set should fail is callback is already set.
lib/UserAgentApplication.ts
Outdated
@@ -1,45 +1,63 @@ | |||
///<reference path='Storage.ts'/> | |||
|
|||
interface Window { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to new file
lib/UserAgentApplication.ts
Outdated
|
||
namespace MSAL { | ||
|
||
interface User { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let this be in its own file.
ee36434
to
57cbc44
Compare
[msal-extensions] Extensions #5
Broker #5: Move initialization out of the constructor
#4