Giter Club home page Giter Club logo

angular-oauth2-oidc-demo's Introduction

angular 8 oauth2 oidc base

依赖

特点

  • 支持单点登录
  • 默认走 sessionStorage 存储,关闭浏览器自动清除登录状态
  • 支持外部配置 auth 设置 [计划中]

修改配置

下面列举最常用的三个配置 打开 app.component.ts 中的 configure 方法中:

  • issuer 配置认证服务器
  • redirectUri 配置回调页
  • clientId 配置 client 唯一 id。

基本操作

登录

this.oauthService.initLoginFlow();

登录回调

const claims = this.oauthService.getIdentityClaims();

打印 claims 看看具体的数据结构吧。

登出

this.oauthService.logOut();

由于 app 组件(壳组件)是必须执行的,所以说目前来说即便没有 guard 也会自动跳转登录。

另外本项目使用的 sessionStorage 存储,因此可以关闭浏览器以清除登录状态。

angular-oauth2-oidc-demo's People

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.