reactjs - 如何将 Windows 身份验证(浏览器)从 React 应用程序传递到 Spnego Kerberos Spring SSO?

标签 reactjs spring-boot spring-security spring-security-kerberos

我们有一个 React 应用程序,它使用从 Spring Boot Web 服务获取数据。两者都部署在同一台服务器(tomcat)中。但我们只需要对来自 React 应用程序的 Web 服务调用进行 Kerberos 身份验证。任何人都可以打开 React 应用程序,但当它导航时,它会调用 webservcie 来获取数据。因此,如果我们将 spring 配置为支持 spnego kerberos spring sso,浏览器是否有可能自动将登录的 Windows 凭据(从 React 应用程序,当在浏览器上运行时)传递到 Spring Boot Web 服务。

我们正在从 React 应用程序调用该服务,如下 -

export const client = rest
  .wrap(mime, { registry: registry })
  .wrap(errorCode)
  .wrap(defaultRequest, {
    headers: {
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    },
    method: 'GET'
  })



export const fetchPDSIs = (Id) =>
  APIHelpers.client(APIHelpers.buildPDSIReq(Id))
    .then(
      response => (response.entity || []).sort((a, b) => a.portalinstance.localeCompare(b.portalinstance))
      ,
      response => {
        global.msg.error(<div className='smallTextNotification'>`Fetching instances and portal for {Id} error: {response.status.code} -> {response.status.text}</div>)
        return []
      }
    )

export const buildPDSIReq = (Id) => ({path: `${serverAddr}/msd232/pdsiii/${Id}`})

最佳答案

使用 fetch API,它通过添加凭据对我有用:“include”

fetch(${authBase}/auth, {credentials: 'include'})

我知道这不是您正在使用的,但它可能会帮助其他读者

关于reactjs - 如何将 Windows 身份验证(浏览器)从 React 应用程序传递到 Spnego Kerberos Spring SSO?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56573623/

相关文章:

java - 无法通过 postman 中的 GET 调用获取 XML 对象

spring - Grails 插件 bean 的重写方法

spring - 动态修改spring security拦截URL

reactjs - 更改 URL 中的单个参数

reactjs - 解析错误: Unexpected reserved word 'static'

node.js - 运行 "npm run build": npm ERR! 代码 ELIFECYCLE npm ERR! 后收到 npm 错误!错误号2

javascript - 带有管理部分的 Reactjs 网站

spring-boot - 如何在 Spring Boot 中禁用重试而不删除它?

java - 运行简单的 Rest Java hello world 程序

javascript - 使用 AngularJS 和 Spring Boot 发布基本身份验证语义?