angular - 从角度组件在 microsoft-adal-angular6 中添加一个 extraQueryParameter login_hint
问题描述
使用以下包https://www.npmjs.com/package/microsoft-adal-angular6我登录到 azure AD。在应用程序模块中,我使用如下的 extraQueryParamter 及其工作。
MsAdalAngular6Module.forRoot({`
tenant: "xxxxxx.onmicrosoft.com",
clientId: "xxxxxxxxxxxxxx",
redirectUri: window.location.origin + '/home',
navigateToLoginRequestUrl: false,
postLogoutRedirectUri: window.location.origin,
cacheLocation: 'localStorage',
extraQueryParameter: 'login_hint=abc@xyz.com'
}),
但是我正在尝试找出如何从组件传递这个 extraQueryParameter: login_hint=abc@xyz.com' (在单击按钮的登录组件页面中,我正在重定向到受路由中的 authencationguard 保护的 URL)。有没有这样做。我无法在 app 模块中预设 login_hint。
解决方案
在该库的源代码中,我在服务文件中添加了另一个函数。
public login_userhint(loginid: string) {
this.context.config.extraQueryParameter = 'login_hint=' + loginid;
this.context.login();
}
在 MsAdalAngular6Service 中。
这解决了我的问题。
推荐阅读
- wpf - 如何使用项目创建 ListView 以添加项目
- android - 无法解析“:app@debugUnitTest/compileClasspath”的依赖关系:无法下载accessibility-test-framework.jar
- aws-lambda - 具有基本身份验证和 ip 白名单的无服务器 + next.js
- azure - MS Azure - 一个组织下可以有多个组织吗?
- java - 获取 Java.lang.LinkageError: ClassCastException
- node.js - 如何在 Angular 或 Node 中检索 DNS 记录
- python - How do I run a function in a class for every object of that class?
- mysql - 我可以用吗 ?mysql中选择查询中的列名?
- python - 如何删除字符串
- reporting-services - 基于表达式的边框样式在 SSRS 2017 的 Excel (.xlsx) 导出中不起作用