Coder Social home page Coder Social logo

Comments (1)

shanzhaozhen avatar shanzhaozhen commented on July 27, 2024 5

直接使用POST /login 传用户名密码进行登录认证,然后取得access token ,而不是使用浏览器的登录页?

首先你说的这点是密码模式的认证方式,不适用与oauth2.1,或者你可以自己做增强让其支持密码模式,可以看我下面所说的demo的password分支

此外
前后端分离我已经找到一个最佳的方式实现了,主要开启客户端信息的 clientAuthenticationMethod(ClientAuthenticationMethod.NONE)clientSettings 设置需要设置为 requireProofKey(true),前端应用可以加入 oidc-client-ts 依赖,或者按照oauth2的认证流程自己编写代码逻辑。
我实现的方式主要是OIDC + PKCE,具体实例是通过 sas 的 issues 的一个大佬中学习的 issues地址
也可以通过我最近弄的demo尝试,我里面用到的登陆页是按照react项目打包再嵌入到后端服务器使用的,习惯了写前端的伙伴可以使用这种方式整合到java后端,毕竟现在偷懒不写样式太难了,很多组件库都不支持CDN了。
在我学习这个oauth认证过程,感觉大家跟我一样主要卡在的位置是不理解前端一个登陆页,认证服务器一个登陆页应该怎么处理这个认证过程,如果密码模式就直接一个post请求过去就好了。但是用授权码模式的话要抛开这个概念,直接把前端的登录页干掉,没进行认证跳转到欢迎页就好,点击欢迎页的登录再跳转到认证服务器的登录页即可。这个过程你可以看看腾讯的应用,目前都已经看不见登陆页,基本都是oauth授权页是吧。各位不要被企业应用的包袱拖累了。
至于原生APP怎么实现呢,因为可能没办法优雅的嵌入完成,虽然可以弹出一个浏览器窗口进行认证也不是不行,之后再研究怎么实现比较好。
@bulldriver
@limng06
@MrQiaoLei

from id-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.