Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

authcrypto

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

authcrypto

Create json-based token, encrypt/decrypt token at other server

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

AuthCrypto

Create json-based token, encrypt/decrypt token at other server

Usage Example


###
  Primary-Server
  server1.com
###
AuthCrypto = require "authcrypto"
AuthCrypto.password = "MySercretP@ssword"

HomeController =
  adminExampleAtServer2:
    userData =
      id: req.user.id
      username: req.user.id + "@server1.com"
      name: req.user.getFullName()
      avatar: req.user.getAvatar()
      role: req.user.role || "user"

    token = AuthCrypto.encrypt userData
    url = "http://server2.com/auth/crypto?redirect=/admin/example&token=" + token
    return res.redirect url

###
  Slave-Server
  server2.com
###
AuthCrypto = require "authcrypto"
AuthCrypto.password = "MySercretP@ssword"

AdminController =
  example:  (req, res) ->
    return res.badRequest {err: "auth"} if !req.user
    return res.json {secret:"information"}

AuthController =
  crypto: (req, res) ->
    converter = ()->
      return {
        id: rawData.username
        fullname: rawData.name
        image: rawData.avatar
        role: if rawData.role == 'root' then 'admin' : 'user'
      }
    AuthCrypto.controller req, res, User, converter

Keywords

FAQs

Package last updated on 20 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc