module Basica
Constants
- HTTP_AUTHORIZATION
Public Instance Methods
basic_auth(env) { |user, pass| ... }
click to toggle source
# File lib/basica.rb, line 6 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