SPLINT Packages Wiki Downloads {} Blog Log In Sign Up

SPLINT

Packages

Wiki

Downloads

{} Blog

Log In


Sign Up

francis94c/http-auth

v0.0.1 1 0 - 0.0 0 {} 0


×

Are you sure you want to delete this package?

Users will no longer be able to intall this package if you do so.

Description

A Library for basic HTTP Authentication in Code Igniter.

README

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.

<?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!"
)
?>
$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.

with from CynoBit