无法从Office 365门户打开我的应用程序。为应用程序错误获取未定义的登录URL

问题描述 投票:0回答:1

我正在将Azure AD登录身份验证集成到我的Web应用程序中。我已经在azure开发门户中创建了一个帐户,并将我的应用注册为网络应用。在应用程序注册设置中,我提供了如下所示的重定向URL,

重定向网址:https://mdb-dev-ext.xyzcde.com/my.dashboard/azureLogin.html

在我的Java Web应用程序中,我已经实现了在上述端点(azureLogin.html)中获取azure令牌的逻辑。我已经使用ADAL java库来实现以下代码逻辑

private AuthenticationResult acquireTokenByAuthorizationCode(String authCode) {
    String authority = System.getProperty("dashboard.azure.authority.url", "https://login.microsoftonline.com/xxxxxxxxxxxxxxxxxxx/oauth2/token");
    String clientId = System.getProperty("dashboard.azure.client.id", "xxxxxxxxxxxxxxxxxxxxxxxxx");
    String clientSecret = System.getProperty("dashboard.azure.client.secret", "xxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    String redirectUrl = System.getProperty("dashboard.azure.redirect.uri", "https://mdb-dev-ext.xyzcde.com/my.dashboard/azureLogin.html?");
    AuthenticationResult result = null;
    ExecutorService service = null;
    try {
      service = Executors.newFixedThreadPool(1);
      AuthenticationContext context = new AuthenticationContext(authority, false, service);
      ClientCredential credential = new ClientCredential(clientId, clientSecret);
      Future<AuthenticationResult> future = context.acquireTokenByAuthorizationCode(authCode, URI.create(redirectUrl), credential, null);
      result = future.get();
    } catch (Exception e) {
      LOGGER.error("Error occurred while acquiring token from Azure {}", e.getMessage());
      throw new Exception(String.format("Error occurred while acquiring token from Azure. %s", e.getMessage()));
    }
    return result;
  }

注意:我尚未提供“主页URL”的值,我认为这不是强制性的

现在在执行以下步骤时,我遇到了错误

登录portal.office.com

使用我的帐户凭据登录

登录到Office 365主页后,我可以看到列出的Web应用程序图标

单击我的Web应用程序的图标/按钮时,我被重定向,最后抛出以下错误。我的Web应用程序的服务器日志中没有日志更新。我确定这还没有到达我的Web应用程序。

"You cannot access this application because it has been misconfigured. Contact your IT department and include the following information:
Undefined Sign-On URL for application"

如果我在如下所示的首页URL字段中提供了Web应用程序的登录URL,则>>

主页URL:https://mdb-dev-ext.xyzcde.com/my.dashboard

然后,当尝试从Office 365打开我的应用程序时,它正在打开我的Web应用程序的登录页面(它将提示您输入应用程序的数据库用户名和密码)。这不是我想要的。

我想实现的目标是->登录到Office 365->单击我的Web应用程序按钮->应该在我的应用程序注册期间加载在Azure门户中提到的重定向URL->这最终将调用在我的Web中编写的代码逻辑应用程序以获取azure令牌,并使用存储在会话中的azure返回令牌登录到我的应用程序。

请让我知道我在这里想念的。为什么我会收到此未定义的登录URL导致应用程序错误?在Office 365门户中单击我的应用程序的图标时,为什么它不重定向到配置的重定向URL?

我正在将Azure AD登录身份验证集成到我的Web应用程序中。我已经在azure开发门户中创建了一个帐户,并将我的应用注册为网络应用。在应用程序注册设置中,我提供了...

java azure azure-active-directory adal adal4j
1个回答
0
投票

问题:“您无法访问此应用程序,因为它配置错误。请与您的IT部门联系并提供以下内容:信息:应用程序的未定义登录URL“

© www.soinside.com 2019 - 2024. All rights reserved.