Sha256: d3703cc3efb6aa8221659aebad22d31ce598eef11f094ba25d71bf5577799d1c
Contents?: true
Size: 306 Bytes
Versions: 1
Compression:
Stored size: 306 Bytes
Contents
require "base64" module Basica HTTP_AUTHORIZATION = "HTTP_AUTHORIZATION".freeze def basic_auth(env) http_auth = env.fetch(HTTP_AUTHORIZATION) do return nil end cred = http_auth.split(" ")[1] user, pass = Base64.decode64(cred).split(":") yield(user, pass) || nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
basica-1.0.0 | lib/basica.rb |