New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

epersonate

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epersonate

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Epersonate Gem

Official Ruby Wrapper for EPersonate API.

EPersonate Documentation

Official EPersonate Documentation

Installation

gem install epersonate

Usage

require 'epersonate'

Using Personal Access Token

Go to https://epersonate.com/app/settings > Personal Access Token > Create Personal Access Token

Add this token to your environment variables.

epersonate = Epersonate.new(EPERSONATE_TOKEN)

Note: Replace EPERSONATE_TOKEN with the token generated before.

Example Usage

In a classic Rails application with a sessions_controller.rb

class SessionsController < ApplicationController

    def login
        (...)
        current_user(user)
    end

    def current_user=(user)
        @current_user = user
    end

    def current_user
        if (@current_user)
            return @current_user
        end

        impersonation = epersonate.verify({request: request})

        if (impersonation["valid"])
            @current_user = User.find(impersonation["userId"].to_i)
        else
            remember_token = User.hexdigest(cookies[:remember_token])
            @current_user ||= User.find_by(remember_token: remember_token)
        end
    end
end

Deploy

  • Update version in epersonate.gemspec
gem build epersonate.gemspec
gem push epersonate.x.x.x.gem

FAQs

Package last updated on 30 Jul 2020

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