A Code Igniter Library for HTTP Authentication.
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
From anywhere you can access the
$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
- 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.
After loading, simply place the below line of code where you want authentication.
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.