使用Office 365和Spring Security登录OpenID Connect [英] OpenID Connect log in in with Office 365 and spring security

查看:136
本文介绍了使用Office 365和Spring Security登录OpenID Connect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 Spring Security 过滤器配置 OpenID Connect ,以授权使用我的Rest API Web.我找到了

实施此操作后,您可以使用Microsoft帐户登录Web应用程序.在为您的Spring Boot应用程序添加应用程序注册"部分中,在第2步中,您可以选择您(或您的应用程序)是否要支持单租户,多租户甚至个人Microsoft帐户(Skype,Xbox等)的帐户.

教程和我的工作测试应用程序之间只有三个两个区别(在08/2020中):

  1. 您必须将两个属性"oauth2AllowImplicitFlow"设置为和"oauth2AllowIdTokenImplicitFlow";变为"true".
  2. application.properties中的属性似乎是"azure.activedirectory.active-directory-groups".而不是"azure.activedirectory.user-group.allowed-groups"

I need to configure OpenID Connect using a Spring Security filter to authorize the consumption of my Rest API Web. I found a Google Login Example, but in my case I need it for Office365. I created my app in Azure and I have configured the corresponding properties. When I try to access my REST API it redirects me to the office login and when I enter the correct credentials this exception is thrown:

解决方案

I don't know the cause for this particular exception, but generally there is a good tutorial at Microsoft Azure developer pages that explains how to use Spring Boot, Spring Security for authentication at Microsoft Azure Active Directory:

https://docs.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-active-directory

With this implemented you can login at your web application with a Microsoft account. In section "Add an application registration for your Spring Boot app" at step 2 you can choose whether you (or your app) want to support accounts single tenant, multi tenant or even personal Microsoft accounts (Skype, Xbox, ...).

There are only three two differences (in 08/2020) between tutorial and my working test-application:

  1. you've got to set both properties "oauth2AllowImplicitFlow" AND "oauth2AllowIdTokenImplicitFlow" to "true".
  2. the property in application.properties seems to be "azure.activedirectory.active-directory-groups" instead of "azure.activedirectory.user-group.allowed-groups"

这篇关于使用Office 365和Spring Security登录OpenID Connect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆