久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 Active Directory 的 Azure 上 Spring OAuth2 應用程序

Redirect URL for Spring OAuth2 app on Azure with Active Directory: Invalid Redirect URI Parameter(使用 Active Directory 的 Azure 上 Spring OAuth2 應用程序的重定向 URL:無效的重定向 URI 參數) - IT屋-程序員軟件開發技術
本文介紹了使用 Active Directory 的 Azure 上 Spring OAuth2 應用程序的重定向 URL:無效的重定向 URI 參數的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在關注 Azure 文檔的以下兩個教程:https://docs.microsoft.com/en-us/azure/java/spring-framework/deploy-spring-boot-java-app-with-maven-plugin它展示了如何將一個簡單的 Spring Boot 應用程序部署到 Azure 和https://docs.microsoft.com/en-us/azure/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-active-directory使用 Spring Security OAuth2 客戶端設置和使用活動目錄作為 OAuth2 服務器.基本上我只是將 OAuth2 依賴項添加到 Maven、WebSecurityConfig 類,如第二個文檔中所示,另外還有 azure.activedirectoy 和 spring.security 屬性.

I am following the following two tutorials of the Azure documentation: https://docs.microsoft.com/en-us/azure/java/spring-framework/deploy-spring-boot-java-app-with-maven-plugin which shows how to deploy a simple Spring Boot application to Azure and https://docs.microsoft.com/en-us/azure/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-active-directory to set up and use an active directory as OAuth2 server with a Spring Security OAuth2 Client. Basically I just add the OAuth2 dependencies to Maven, a WebSecurityConfig class as shown in the second document and additionally also the azure.activedirectoy and spring.security properties.

當應用程序從我的本地計算機運行時,登錄和重定向工作正常.但是當應用程序部署到 Azure 時,我收到一個應用程序錯誤消息:無效的重定向 URI 參數.我想我已將重定向 uri 正確設置為

When the application is just run from my local computer the login and redirection works fine. But when the application is deployed to Azure, I get an application error saying: Invalid Redirect URI Parameter. I think I have set the redirect-uri correctly as

https://{baseHost}{basePort}{basePath}/login/oauth2/code/azure

在應用程序屬性中以及在我的 Active Directory 中的應用程序注冊中.

in the application properties as well as in the application registration with my Active Directory.

據我所知,授權請求使用了正確的參數:

As far as I can see the authorization request uses the right parameters:

response_type: code
client_id: 4b5fbcfd-c35f-4bab-bc45-374c7e1dead8
scope: openid https://graph.microsoft.com/user.read
state: yMvo62R-6vgjETSGr_mnh4iIMZimVnFYZRyiGFaOPtE=
redirect_uri: https://myappname.azurewebsites.net/login/oauth2/code/azure
nonce: FUXJ5GoJ2NuNVx2ORU70YCqnJkEj8FRYHEJYMutEQzo

那么,無效的重定向 URI 參數是什么,我該如何更改?

So, what could the Invalid Redirect URI Parameter be, and how can I change this?

推薦答案

我按照這兩個教程,在本地環境下運行良好,在 Azure webapp 上,我遇到了重定向 url 不匹配錯誤.

I followed these two tutorials, it works fine on local environment, on Azure webapp, I encountered redirect url mismatch error.

原因是redirect_uri總是以http開頭.在 applications.properties 中添加 server.forward-headers-strategy=native 后,它就可以工作了.(我使用的是spring boot 2.2)

The cause is that the redirect_uri is always started with http. After adding server.forward-headers-strategy=native in applications.properties, it works. (I am using spring boot 2.2)

這里是 pom.xml 供您參考.

Here is the pom.xml for your reference.

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">  
  <modelVersion>4.0.0</modelVersion>  
  <parent> 
    <groupId>org.springframework.boot</groupId>  
    <artifactId>spring-boot-starter-parent</artifactId>  
    <version>2.2.4.RELEASE</version>  
    <relativePath/>  
    <!-- lookup parent from repository --> 
  </parent>  
  <groupId>com.example.ad</groupId>  
  <artifactId>ad</artifactId>  
  <version>0.0.1-SNAPSHOT</version>  
  <name>ad</name>  
  <description>Demo project for Spring Boot</description>  
  <properties> 
    <java.version>1.8</java.version>  
    <azure.version>2.2.0</azure.version> 
  </properties>  
  <dependencies> 
    <dependency> 
      <groupId>org.springframework.boot</groupId>  
      <artifactId>spring-boot-starter-security</artifactId> 
    </dependency>  
    <dependency> 
      <groupId>org.springframework.boot</groupId>  
      <artifactId>spring-boot-starter-web</artifactId> 
    </dependency>  
    <dependency> 
      <groupId>com.microsoft.azure</groupId>  
      <artifactId>azure-active-directory-spring-boot-starter</artifactId> 
    </dependency>  
    <dependency> 
      <groupId>org.springframework.boot</groupId>  
      <artifactId>spring-boot-starter-test</artifactId>  
      <scope>test</scope>  
      <exclusions> 
        <exclusion> 
          <groupId>org.junit.vintage</groupId>  
          <artifactId>junit-vintage-engine</artifactId> 
        </exclusion> 
      </exclusions> 
    </dependency>  
    <dependency> 
      <groupId>org.springframework.security</groupId>  
      <artifactId>spring-security-test</artifactId>  
      <scope>test</scope> 
    </dependency>  
    <dependency> 
      <groupId>org.springframework.security</groupId>  
      <artifactId>spring-security-oauth2-client</artifactId> 
    </dependency>  
    <dependency> 
      <groupId>org.springframework.security</groupId>  
      <artifactId>spring-security-oauth2-jose</artifactId> 
    </dependency> 
  </dependencies>  
  <dependencyManagement> 
    <dependencies> 
      <dependency> 
        <groupId>com.microsoft.azure</groupId>  
        <artifactId>azure-spring-boot-bom</artifactId>  
        <version>${azure.version}</version>  
        <type>pom</type>  
        <scope>import</scope> 
      </dependency> 
    </dependencies> 
  </dependencyManagement>  
  <build> 
    <plugins> 
      <plugin> 
        <groupId>org.springframework.boot</groupId>  
        <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin>  
      <plugin> 
        <groupId>com.microsoft.azure</groupId>  
        <artifactId>azure-webapp-maven-plugin</artifactId>  
        <version>1.9.0</version>  
        <configuration>
          <schemaVersion>V2</schemaVersion>
          <resourceGroup>ad-1582615028467-rg</resourceGroup>
          <appName>ad-1582615028467</appName>
          <pricingTier>P1v2</pricingTier>
          <region>westeurope</region>
          <runtime>
            <os>linux</os>
            <javaVersion>jre8</javaVersion>
            <webContainer>jre8</webContainer>
          </runtime>
            <appSettings>
                <property>
                    <name>JAVA_OPTS</name>
                    <value>-Dserver.port=80</value>
                </property>
            </appSettings>
          <deployment>
            <resources>
              <resource>
                <directory>${project.basedir}/target</directory>
                <includes>
                  <include>*.jar</include>
                </includes>
              </resource>
            </resources>
          </deployment>
        </configuration>
      </plugin> 
    </plugins> 
  </build> 
</project>

這篇關于使用 Active Directory 的 Azure 上 Spring OAuth2 應用程序的重定向 URL:無效的重定向 URI 參數的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Why does the android emulator camera stop unexpectedly?(為什么android模擬器相機會意外停止?)
Android camera , onPictureTaken(byte[] imgData, Camera camera) method amp; PictureCallback never called(Android camera , onPictureTaken(byte[] imgData, Camera camera) 方法 amp;PictureCallback 從未調用過) - IT屋-程序員軟件開發技
Understanding the libGDX Projection Matrix(了解 libGDX 投影矩陣)
QR code reading with camera - Android(使用相機讀取二維碼 - Android)
IP camera with OpenCv in Java(Java中帶有OpenCv的IP攝像頭)
Android mock Camera(Android 模擬相機)
主站蜘蛛池模板: 黄色免费网站在线看 | 久久久精品网 | 国产精品亚洲一区二区三区在线观看 | 日韩精品福利 | 日韩av在线免费 | 午夜视频在线 | 成人欧美一区二区三区在线播放 | 亚洲成人国产 | 日本特黄a级高清免费大片 国产精品久久性 | 美女一级a毛片免费观看97 | 国产精品免费大片 | 久久久女女女女999久久 | 日日天天| 欧美aⅴ在线观看 | 欧美乱大交xxxxx另类电影 | 自拍偷拍欧美 | 国产福利在线 | 免费一级大片 | 人成在线视频 | 国产欧美精品一区二区 | 午夜av电影 | 97色伦网| 日韩二 | 日日碰碰 | 亚洲成人中文字幕 | 久久国产精品无码网站 | 国产乱码一区 | 欧美激情久久久 | 婷婷综合五月天 | 精品视频一区二区三区 | 亚洲国产视频一区二区 | 免费 视频 1级 | 久久精品美女 | 成年人在线观看视频 | 日韩一区二区三区在线视频 | 日本电影一区二区 | 新超碰97 | 日本久久精 | 91久久久久久久久久久 | 中文字幕一区二区三区四区五区 | 91文字幕巨乱亚洲香蕉 |