All Projects → HashLoad → horse-basic-auth

HashLoad / horse-basic-auth

Licence: MIT license
Middleware for Basic Authentication in HORSE

Programming Languages

pascal
1382 projects

Projects that are alternatives of or similar to horse-basic-auth

horse-jwt
Middleware for JWT in HORSE
Stars: ✭ 39 (+5.41%)
Mutual labels:  auth, horse
jwt-auth
JSON Web Token Authentication for Thinkphp
Stars: ✭ 113 (+205.41%)
Mutual labels:  auth
mod authnz jwt
An authentication module for Apache httpd using JSON Web Tokens
Stars: ✭ 74 (+100%)
Mutual labels:  auth
remix-auth
Simple Authentication for Remix
Stars: ✭ 929 (+2410.81%)
Mutual labels:  auth
microauth
Collection of authentication modules for ▲zeit's micro.
Stars: ✭ 71 (+91.89%)
Mutual labels:  auth
Flask-GraphQL-Auth
(UNMAINTAINED. FEEL FREE TO FORK) 🐍A Pythonic way to provide JWT authentication for Flask-GraphQL
Stars: ✭ 64 (+72.97%)
Mutual labels:  auth
PiggyAuth
Safe & feature-rich auth plugin. Project has been discontinued
Stars: ✭ 33 (-10.81%)
Mutual labels:  auth
codeigniter4-authentication
The codeigniter4\authentication component provides an API for authentication and includes concrete authentication adapters for common use case scenarios.
Stars: ✭ 34 (-8.11%)
Mutual labels:  auth
firebase auth oauth
A Flutter plugin that makes it easy to perform OAuth sign in flows using FirebaseAuth.
Stars: ✭ 28 (-24.32%)
Mutual labels:  auth
TwitchAuth
Unreal Engine 4 Plugin for In-Game Twitch Authentication.
Stars: ✭ 21 (-43.24%)
Mutual labels:  auth
svelte-commerce
Svelte ecommerce - Headless, Authentication, Cart & Checkout, TailwindCSS, Server Rendered, Proxy + API Integrated, Animations, Stores, Lazy Loading, Loading Indicators, Carousel, Instant Search, Faceted Filters, Typescript, Open Source, MIT license. 1 command deploy to your own server, 1 click deploy to netlify.
Stars: ✭ 695 (+1778.38%)
Mutual labels:  auth
iron-session
🛠 Node.js stateless session utility using signed and encrypted cookies to store data. Works with Next.js, Express, NestJs, Fastify, and any Node.js HTTP framework.
Stars: ✭ 1,729 (+4572.97%)
Mutual labels:  auth
capacitor-firebase-authentication
⚡️ Capacitor plugin for Firebase Authentication.
Stars: ✭ 67 (+81.08%)
Mutual labels:  auth
amplify-material-ui
A Material-UI based implementation of aws amplify
Stars: ✭ 32 (-13.51%)
Mutual labels:  auth
laravel-nuxt
Laravel 5.6 + Nuxt 1.4: Auth Starter (SSR, SPA, Socialite)
Stars: ✭ 19 (-48.65%)
Mutual labels:  auth
react-auth-kit
Easily manage Authentication state of users in React-based Apps using Hooks and Higher-order components
Stars: ✭ 177 (+378.38%)
Mutual labels:  auth
logto
🧑‍🚀 Logto helps you build the sign-in, auth, and user identity within minutes. We provide an OIDC-based identity service and the end-user experience with username, phone number, email, and social sign-in, with extendable multi-language support.
Stars: ✭ 3,421 (+9145.95%)
Mutual labels:  auth
Opux
Opux is a Discord bot for EVEOnline
Stars: ✭ 13 (-64.86%)
Mutual labels:  auth
ertis-auth
Generic token generator and validator service like auth
Stars: ✭ 28 (-24.32%)
Mutual labels:  auth
aws-mobilehub-helper-ios
ARCHIVED: Use https://github.com/aws/aws-sdk-ios/
Stars: ✭ 41 (+10.81%)
Mutual labels:  auth

horse-basic-auth

horse-basic-auth is a official middleware for working with basic authentication in APIs developed with the Horse framework.
We created a channel on Telegram for questions and support:

⚙️ Installation

Installation is done using the boss install command:

boss install horse-basic-auth

If you choose to install manually, simply add the following folders to your project, in Project > Options > Resource Compiler > Directories and Conditionals > Include file search path

../horse-basic-auth/src

✔️ Compatibility

This middleware is compatible with projects developed in:

  • Delphi
  • Lazarus

⚡️ Quickstart Delphi

uses 
  Horse, 
  Horse.BasicAuthentication, // It's necessary to use the unit
  System.SysUtils;

begin
  // It's necessary to add the middleware in the Horse:
  THorse.Use(HorseBasicAuthentication(
    function(const AUsername, APassword: string): Boolean
    begin
      // Here inside you can access your database and validate if username and password are valid
      Result := AUsername.Equals('user') and APassword.Equals('password');
    end));
    
  // The default header for receiving credentials is "Authorization".
  // You can change, if necessary:
  // THorse.Use(HorseBasicAuthentication(MyCallbackValidation, THorseBasicAuthenticationConfig.New.Header('X-My-Header-Authorization')));

  // You can also ignore routes:
  // THorse.Use(HorseBasicAuthentication(MyCallbackValidation, THorseBasicAuthenticationConfig.New.SkipRoutes(['/ping'])));

  THorse.Get('/ping',
    procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
    begin
      Res.Send('pong');
    end);

  THorse.Listen(9000);
end;

⚡️ Quickstart Lazarus

{$MODE DELPHI}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Horse,
  Horse.BasicAuthentication, // It's necessary to use the unit
  SysUtils;

procedure GetPing(Req: THorseRequest; Res: THorseResponse; Next: TNextProc);
begin
  Res.Send('Pong');
end;

function DoLogin(const AUsername, APassword: string): Boolean;
begin
  // Here inside you can access your database and validate if username and password are valid
  Result := AUsername.Equals('user') and APassword.Equals('password');
end;

begin
  // It's necessary to add the middleware in the Horse:
  THorse.Use(HorseBasicAuthentication(DoLogin));

  // The default header for receiving credentials is "Authorization".
  // You can change, if necessary:
  // THorse.Use(HorseBasicAuthentication(MyCallbackValidation, THorseBasicAuthenticationConfig.New.Header('X-My-Header-Authorization')));

  // You can also ignore routes:
  // THorse.Use(HorseBasicAuthentication(MyCallbackValidation, THorseBasicAuthenticationConfig.New.SkipRoutes(['/ping'])));

  THorse.Get('/ping', GetPing);

  THorse.Listen(9000);
end.

📌 Status Code

This middleware can return the following status code:

  • 401 - Unauthorized
  • 500 - InternalServerError

⚠️ License

horse-basic-auth is free and open-source middleware licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].