实例介绍
基于express封装的用户鉴权功能,基本原理: 1、用jsonwebtoken生成token 2、用express-jwt验证token是否过期或失效 3、用jsonwebtoken解析出token中的用户信息,比如用户id
【实例截图】
【核心代码】
express之token验证用户身份信息.zip
└── express之token验证用户身份信息
├── app.js
├── bin
│ └── www
├── node_modules
│ ├── accepts
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── array-flatten
│ │ ├── array-flatten.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── async
│ │ ├── CHANGELOG.md
│ │ ├── dist
│ │ │ ├── async.js
│ │ │ └── async.min.js
│ │ ├── lib
│ │ │ └── async.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── basic-auth
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── body-parser
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── lib
│ │ │ ├── read.js
│ │ │ └── types
│ │ │ ├── json.js
│ │ │ ├── raw.js
│ │ │ ├── text.js
│ │ │ └── urlencoded.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── buffer-equal-constant-time
│ │ ├── index.js
│ │ ├── LICENSE.txt
│ │ ├── package.json
│ │ ├── README.md
│ │ └── test.js
│ ├── bytes
│ │ ├── History.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── Readme.md
│ ├── content-disposition
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── content-type
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── cookie
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── cookie-parser
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── cookie-signature
│ │ ├── History.md
│ │ ├── index.js
│ │ ├── package.json
│ │ └── Readme.md
│ ├── debug
│ │ ├── CHANGELOG.md
│ │ ├── component.json
│ │ ├── karma.conf.js
│ │ ├── LICENSE
│ │ ├── Makefile
│ │ ├── node.js
│ │ ├── package.json
│ │ ├── README.md
│ │ └── src
│ │ ├── browser.js
│ │ ├── debug.js
│ │ ├── index.js
│ │ ├── inspector-log.js
│ │ └── node.js
│ ├── depd
│ │ ├── History.md
│ │ ├── index.js
│ │ ├── lib
│ │ │ ├── browser
│ │ │ │ └── index.js
│ │ │ └── compat
│ │ │ ├── callsite-tostring.js
│ │ │ ├── event-listener-count.js
│ │ │ └── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── Readme.md
│ ├── destroy
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── ecdsa-sig-formatter
│ │ ├── CODEOWNERS
│ │ ├── LICENSE
│ │ ├── package.json
│ │ ├── README.md
│ │ └── src
│ │ ├── ecdsa-sig-formatter.d.ts
│ │ ├── ecdsa-sig-formatter.js
│ │ └── param-bytes-for-alg.js
│ ├── ee-first
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── ejs
│ │ ├── ejs.js
│ │ ├── ejs.min.js
│ │ ├── Jakefile
│ │ ├── lib
│ │ │ ├── ejs.js
│ │ │ └── utils.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── encodeurl
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── escape-html
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── Readme.md
│ ├── etag
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── express
│ │ ├── History.md
│ │ ├── index.js
│ │ ├── lib
│ │ │ ├── application.js
│ │ │ ├── express.js
│ │ │ ├── middleware
│ │ │ │ ├── init.js
│ │ │ │ └── query.js
│ │ │ ├── request.js
│ │ │ ├── response.js
│ │ │ ├── router
│ │ │ │ ├── index.js
│ │ │ │ ├── layer.js
│ │ │ │ └── route.js
│ │ │ ├── utils.js
│ │ │ └── view.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── Readme.md
│ ├── express-jwt
│ │ ├── bin
│ │ │ └── changelog
│ │ ├── CHANGELOG.md
│ │ ├── lib
│ │ │ ├── errors
│ │ │ │ └── UnauthorizedError.js
│ │ │ └── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ ├── README.md
│ │ └── test
│ │ ├── jwt.test.js
│ │ ├── multitenancy.test.js
│ │ ├── revocation.test.js
│ │ └── string_token.test.js
│ ├── express-unless
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ ├── README.md
│ │ └── test
│ │ └── unless.tests.js
│ ├── finalhandler
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── forwarded
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── fresh
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── http-errors
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── iconv-lite
│ │ ├── Changelog.md
│ │ ├── encodings
│ │ │ ├── dbcs-codec.js
│ │ │ ├── dbcs-data.js
│ │ │ ├── index.js
│ │ │ ├── internal.js
│ │ │ ├── sbcs-codec.js
│ │ │ ├── sbcs-data-generated.js
│ │ │ ├── sbcs-data.js
│ │ │ ├── tables
│ │ │ │ ├── big5-added.json
│ │ │ │ ├── cp936.json
│ │ │ │ ├── cp949.json
│ │ │ │ ├── cp950.json
│ │ │ │ ├── eucjp.json
│ │ │ │ ├── gb18030-ranges.json
│ │ │ │ ├── gbk-added.json
│ │ │ │ └── shiftjis.json
│ │ │ ├── utf16.js
│ │ │ └── utf7.js
│ │ ├── lib
│ │ │ ├── bom-handling.js
│ │ │ ├── extend-node.js
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ └── streams.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── inherits
│ │ ├── inherits_browser.js
│ │ ├── inherits.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── ipaddr.js
│ │ ├── ipaddr.min.js
│ │ ├── lib
│ │ │ ├── ipaddr.js
│ │ │ └── ipaddr.js.d.ts
│ │ ├── package.json
│ │ └── README.md
│ ├── jsonwebtoken
│ │ ├── CHANGELOG.md
│ │ ├── decode.js
│ │ ├── index.js
│ │ ├── lib
│ │ │ ├── JsonWebTokenError.js
│ │ │ ├── NotBeforeError.js
│ │ │ ├── psSupported.js
│ │ │ ├── timespan.js
│ │ │ └── TokenExpiredError.js
│ │ ├── LICENSE
│ │ ├── node_modules
│ │ │ └── ms
│ │ │ ├── index.js
│ │ │ ├── license.md
│ │ │ ├── package.json
│ │ │ └── readme.md
│ │ ├── package.json
│ │ ├── README.md
│ │ ├── sign.js
│ │ └── verify.js
│ ├── jwa
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── jws
│ │ ├── CHANGELOG.md
│ │ ├── index.js
│ │ ├── lib
│ │ │ ├── data-stream.js
│ │ │ ├── sign-stream.js
│ │ │ ├── tostring.js
│ │ │ └── verify-stream.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── readme.md
│ ├── lodash.includes
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── lodash.isboolean
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── lodash.isinteger
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── lodash.isnumber
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── lodash.isplainobject
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── lodash.isstring
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── lodash.once
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── lodash.set
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── media-typer
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── merge-descriptors
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── methods
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── mime
│ │ ├── build
│ │ │ ├── build.js
│ │ │ └── test.js
│ │ ├── cli.js
│ │ ├── LICENSE
│ │ ├── mime.js
│ │ ├── package.json
│ │ ├── README.md
│ │ └── types.json
│ ├── mime-db
│ │ ├── db.json
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── mime-types
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── morgan
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── ms
│ │ ├── index.js
│ │ ├── license.md
│ │ ├── package.json
│ │ └── readme.md
│ ├── negotiator
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── lib
│ │ │ ├── charset.js
│ │ │ ├── encoding.js
│ │ │ ├── language.js
│ │ │ └── mediaType.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── on-finished
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── on-headers
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── parseurl
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── path-to-regexp
│ │ ├── History.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── Readme.md
│ ├── proxy-addr
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── qs
│ │ ├── CHANGELOG.md
│ │ ├── dist
│ │ │ └── qs.js
│ │ ├── lib
│ │ │ ├── formats.js
│ │ │ ├── index.js
│ │ │ ├── parse.js
│ │ │ ├── stringify.js
│ │ │ └── utils.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ ├── README.md
│ │ └── test
│ │ ├── index.js
│ │ ├── parse.js
│ │ ├── stringify.js
│ │ └── utils.js
│ ├── range-parser
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── raw-body
│ │ ├── HISTORY.md
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── safe-buffer
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── safer-buffer
│ │ ├── dangerous.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ ├── Porting-Buffer.md
│ │ ├── Readme.md
│ │ ├── safer.js
│ │ └── tests.js
│ ├── semver
│ │ ├── bin
│ │ │ └── semver
│ │ ├── LICENSE
│ │ ├── package.json
│ │ ├── range.bnf
│ │ ├── README.md
│ │ └── semver.js
│ ├── send
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── serve-static
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── setprototypeof
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── statuses
│ │ ├── codes.json
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── type-is
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── unpipe
│ │ ├── HISTORY.md
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ ├── utils-merge
│ │ ├── index.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ └── README.md
│ └── vary
│ ├── HISTORY.md
│ ├── index.js
│ ├── LICENSE
│ ├── package.json
│ └── README.md
├── package.json
├── package-lock.json
├── public
│ ├── images
│ ├── javascripts
│ │ └── token_vertify.js
│ └── stylesheets
│ └── style.css
├── routes
│ ├── login.js
│ └── users.js
└── views
├── error.ejs
└── index.ejs
111 directories, 444 files
标签:
相关软件
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论