如何解决除装饰器以外的MSAL的外部配置
我是Angular的新手,最近被要求从事MSAL工作。这就是我配置MSAL的方式。
在应用模块下导入
MsalModule.forRoot({
auth: {
clientId: 'myclientid',// This is your client ID
authority: 'https://login.microsoftonline.com/tenantid',// This is your tenant ID
redirectUri: 'http://localhost:4200'// This is your redirect URI
//redirectUri: 'https://myapiurl.com'// This is your redirect URI
},cache: {
cacheLocation: 'localStorage',storeAuthStateInCookie: isIE,// Set to true for Internet Explorer 11
},},{
popUp: !isIE,consentScopes: [
'user.read', 'openid', 'apiguid/user_impersonation', ],unprotectedResources: [],protectedResourceMap: [
[
'https://localhost:44331/', ['apiguid/user_impersonation'], ], [
'https://myapiurl.com/userimpersonation/',extraQueryParameters: {}
})
但是我的问题是,因为配置位于装饰器中,所以我发现很难为诸如ClientID之类的每个属性使用动态值。
因此,MSAL中可以通过任何方式将配置作为JSON文件或其他功能加载
解决方法
我有一个解决方案,我认为这是一个非常好的解决方案,并且可以使它起作用。
分享给遇到相同问题的人
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。