Skip to content
A Code Igniter Library for HTTP Authentication.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
libraries
tests
LICENSE
README.md
splint.json

README.md

License MIT Splint Latest Release Commits

http-auth

A Code Igniter Library for HTTP Authentication.

Installation

To install, download and install Splint from https://splint.cynobit.com/downloads/splint and then run the below from your Code Igniter project root.

splint install francis94c/http-auth

Loading

From anywhere you can access the CI instance

$params = array(
  "auth" => array (
    "username" => "hashed_password"
  ),
  "bearer" => "Bearer Name",
  "denied_message" => "Access Denied!"
);
$this->load->splint("francis94c/http-auth", "+HTTPAuth", $params, "http_auth");

OR Alternatively load with the below steps.

  • create a file http_auth_config.php in your application/config folder.
  • Add the below contents into the file created above.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$config["http_auth_config"] = array(
  "auth" => array (
    "username" => "hashed_password"
  ),
  "bearer" => "Bearer Name",
  "denied_message" => "Access Denied!"
)
?>
  • Then load with the single line of code.
$this->load->package("francis94c/http-auth");

Usage

After loading, simply place the below line of code where you want authentication.

$this->http_auth->authenticate();

The above is most preferable at a Controller's Constructor.

This will output your $denied_message if authentication fails or allow the rest of the Controller to run if successful.

You can’t perform that action at this time.