class Orion::Middleware::APIKeyAuth

Overview

API Key authentication Validates API keys in custom header or query parameter

Usage: use Orion::Middleware::APIKeyAuth.new( keys: ["key1", "key2"], header_name: "X-API-Key" )

Defined in:

orion/middleware/auth.cr

Constructors

Instance Method Summary

Instance methods inherited from class Orion::Middleware::Auth

authenticate(context : Orion::Server::Context) : Bool authenticate, call(context : HTTP::Server::Context) call, unauthorized_response(context : Orion::Server::Context) unauthorized_response

Constructor Detail

def self.new(keys : Array(String), header_name : String = "X-API-Key", query_param : String | Nil = "api_key") #

Instance Method Detail

def authenticate(context : Orion::Server::Context) : Bool #
Description copied from class Orion::Middleware::Auth

Override this to implement authentication logic


def header_name : String #

def header_name=(header_name : String) #

def keys : Array(String) #

def keys=(keys : Array(String)) #

def query_param : String | Nil #

def query_param=(query_param : String | Nil) #