HRM-10/HRM.UI/ClientApp/src/app/SSO.Config.ts

60 lines
2.2 KiB
TypeScript
Raw Normal View History

2026-11-03 13:06:00 +06:00
// src/app/msal-config.ts
import { LogLevel,PublicClientApplication } from '@azure/msal-browser';
import { MsalInterceptorConfiguration, MsalGuardConfiguration } from '@azure/msal-angular';
import { MSAL_INSTANCE, MSAL_GUARD_CONFIG, MSAL_INTERCEPTOR_CONFIG } from '@azure/msal-angular';
import { InteractionType } from '@azure/msal-browser';
const loggerCallback = (logLevel: LogLevel, message: string) => {
console.log('MSAL:', message);
};
export const msalInstanceConfig = {
auth: {
// clientId: 'ac400e87-866c-4498-bd88-f02d96a7e4c3',
// redirectUri: 'http://localhost:4200',
// authority: 'https://login.microsoftonline.com/50f23abd-2de3-4dd4-a1c9-571b7c9ebe4e'
//for PETROMAX(development)
clientId: 'ca3fba22-bf8e-40b7-bc95-88bf4481019d',
redirectUri: 'http://localhost:4200',
authority: 'https://login.microsoftonline.com/0ccbbd58-9cd0-415c-a100-c6ac318a5a14'
//for PETROMAX(cel cloude)
// clientId: '38249861-a763-4130-b144-90b40a4764a2',
// redirectUri: 'https://celclouds.com/Petromax',
// authority: 'https://login.microsoftonline.com/7b81ccc5-ba35-4bf8-854f-49f9c02d3fb1'
//for PETROMAX(CEL UAT)
// clientId: '5d67ff94-6b09-493f-9481-0230773eb0ff',
// redirectUri: 'https://celbd.com/petromaxHRUAT',
// authority: 'https://login.microsoftonline.com/0ccbbd58-9cd0-415c-a100-c6ac318a5a14'
//for SGSREVAMP(CEL UAT)
// clientId: 'c3356e94-eba4-43a3-b516-cb9a2d1cfe83',
// redirectUri: 'https://celbd.com/sgsRevamp',
// authority: 'https://login.microsoftonline.com/0ccbbd58-9cd0-415c-a100-c6ac318a5a14'
},
cache: {
cacheLocation: 'localStorage'
},
system: {
loggerOptions: {
loggerCallback: (level: LogLevel, message: string) => {
console.log("MSAL:", message);
},
logLevel: LogLevel.Info,
piiLoggingEnabled: false
}
}
};
export const msalGuardConfig: MsalGuardConfiguration = {
interactionType: InteractionType.Redirect, // ✅ USE ENUM VALUE
authRequest: {
scopes: ['user.read']
}
};
export const msalInterceptorConfig: MsalInterceptorConfiguration = {
interactionType: InteractionType.Redirect, // ✅ USE ENUM VALUE
protectedResourceMap: new Map([
['https://graph.microsoft.com/v1.0/me', ['user.read']]
])
};