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

使用 Active Directory 的 Azure 上 Spring OAuth2 應(yīng)用程序

Redirect URL for Spring OAuth2 app on Azure with Active Directory: Invalid Redirect URI Parameter(使用 Active Directory 的 Azure 上 Spring OAuth2 應(yīng)用程序的重定向 URL:無(wú)效的重定向 URI 參數(shù)) - IT屋-程序員軟件開(kāi)發(fā)技術(shù)
本文介紹了使用 Active Directory 的 Azure 上 Spring OAuth2 應(yīng)用程序的重定向 URL:無(wú)效的重定向 URI 參數(shù)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我正在關(guān)注 Azure 文檔的以下兩個(gè)教程:https://docs.microsoft.com/en-us/azure/java/spring-framework/deploy-spring-boot-java-app-with-maven-plugin它展示了如何將一個(gè)簡(jiǎn)單的 Spring Boot 應(yīng)用程序部署到 Azure 和https://docs.microsoft.com/en-us/azure/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-active-directory使用 Spring Security OAuth2 客戶端設(shè)置和使用活動(dòng)目錄作為 OAuth2 服務(wù)器.基本上我只是將 OAuth2 依賴項(xiàng)添加到 Maven、WebSecurityConfig 類,如第二個(gè)文檔中所示,另外還有 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.

當(dāng)應(yīng)用程序從我的本地計(jì)算機(jī)運(yùn)行時(shí),登錄和重定向工作正常.但是當(dāng)應(yīng)用程序部署到 Azure 時(shí),我收到一個(gè)應(yīng)用程序錯(cuò)誤消息:無(wú)效的重定向 URI 參數(shù).我想我已將重定向 uri 正確設(shè)置為

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

在應(yīng)用程序?qū)傩灾幸约霸谖业?Active Directory 中的應(yīng)用程序注冊(cè)中.

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

據(jù)我所知,授權(quán)請(qǐng)求使用了正確的參數(shù):

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

那么,無(wú)效的重定向 URI 參數(shù)是什么,我該如何更改?

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

推薦答案

我按照這兩個(gè)教程,在本地環(huán)境下運(yùn)行良好,在 Azure webapp 上,我遇到了重定向 url 不匹配錯(cuò)誤.

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

原因是redirect_uri總是以http開(kāi)頭.在 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>

這篇關(guān)于使用 Active Directory 的 Azure 上 Spring OAuth2 應(yīng)用程序的重定向 URL:無(wú)效的重定向 URI 參數(shù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Why does the android emulator camera stop unexpectedly?(為什么android模擬器相機(jī)會(huì)意外停止?)
Android camera , onPictureTaken(byte[] imgData, Camera camera) method amp; PictureCallback never called(Android camera , onPictureTaken(byte[] imgData, Camera camera) 方法 amp;PictureCallback 從未調(diào)用過(guò)) - IT屋-程序員軟件開(kāi)發(fā)技
Understanding the libGDX Projection Matrix(了解 libGDX 投影矩陣)
QR code reading with camera - Android(使用相機(jī)讀取二維碼 - Android)
IP camera with OpenCv in Java(Java中帶有OpenCv的IP攝像頭)
Android mock Camera(Android 模擬相機(jī))
主站蜘蛛池模板: 欧美色综合一区二区三区 | 免费一区| 久久久久一区 | 成人免费视频网站在线看 | av网站免费观看 | 亚洲免费毛片 | 欧美韩一区二区 | 91久久精品一区二区二区 | 少妇一级淫片免费放播放 | 久久久久国产精品 | 久久久国产精品一区 | 国产精品精品视频一区二区三区 | 欧美日韩在线电影 | 国产成人精品久久二区二区91 | 一区二区三区四区免费在线观看 | 99视频网站| 中文字幕精品一区二区三区精品 | 亚洲一区二区在线播放 | 成人小视频在线免费观看 | 夜久久 | 国产精品区二区三区日本 | 欧美一级电影免费 | 国产在线视频一区二区 | 美女一区二区在线观看 | 亚洲欧美日韩精品久久亚洲区 | 午夜影院污 | 亚洲一区二区三区免费在线 | 欧美激情va永久在线播放 | 电影91久久久 | 精品国产黄色片 | 精品中文字幕在线观看 | 一级片av | 国产精品久久久久久久久久 | 黄色av网站在线观看 | 国产情侣激情 | 美女午夜影院 | 国产91精品久久久久久久网曝门 | 精品成人 | 成人福利在线视频 | 欧美a在线| 亚洲最新网址 |