• Stars
    star
    136
  • Rank 266,902 (Top 6 %)
  • Language
    PHP
  • Created about 13 years ago
  • Updated almost 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

LONG DEAD EXPERIMENT

NinjAuth

Use the OAuth and OAuth2 packages to authenticate users with an array of third-party services in a totally integrated and abstracted fashion. Users can currently be managed by SimpleAuth or Sentry.

Implementation requires only one controller and one database table (two if you count users).

The name "NinjAuth" comes from the company behind the project: HappyNinjas.

Supported Strategies

  • OAuth
  • OAuth2
  • OpenID (by krtek4)

TODO

  • XAuth - anyone?
  • More flexible registration (view files as properties, or config options)

Installation

# Create users if this table does not exist already
$ oil g migration create_users username:varchar[50] password:string group:int email:string last_login:integer login_hash:string profile_fields:text created_at:int
$ oil refine migrate

# Run migrations in the package to create "authentications" table
$ oil refine migrate --packages=ninjauth

-NOTE: For Fuel v1.3+, add or uncomment the PKGPATH to the 'package_paths' variable in fuel/app/config/config.php

Upgrade

Just the usual submodule update, and when you're done run:

$ oil refine migrate --packages=ninjauth

Usage Example

Controller

http://example.com/auth/session/facebook

class Controller_Auth extends \NinjAuth\Controller {
	public static $linked_redirect = '/auth/linked';
	public static $login_redirect = '/';
	public static $register_redirect = '/auth/register';
	public static $registered_redirect = '/auth/registered';

	/*
	*	Example registered action for SimpleAuth (Should work with others)
	*
	*/
	public function action_registered(){

		$auth = Auth::instance();
		$user_id = Session::get_flash('ninjauth.user_id');

		if(isset($user_id)){
			Auth::instance()->force_login($user_id);
			return Response::redirect('/dashboard');
		}

		return $this->response;
	}
}

Configuration

'somewhere' => array(
	'id' => '9cd980e0d883ERG42974b6cd78175135',
	'secret' => '19d874DW43534SDFfce025d9bba4423452',
	
	// Specify a specific callback
	'callback' => 'http://example.com/foo/bar',
),

'google' => array(
	'key' => 'yourkey',
	'secret' => 'yoursecret',
	
	// Provide a string or array for the API scope
	'scope' => array('https://www.google.com/analytics/feeds', 'https://www.google.com/m8/feeds'),
	
	// Google supports OAuth and OAuth2. Pick a specific
	'strategy' => 'OAuth',
),

Service authentication setup links

More Repositories

1

awesome-earth

"What can I do about the climate crisis?" Here are 326 things you can do.
JavaScript
1,330
star
2

codeigniter-restclient

STOP USING THIS USE GUZZLE INSTEAD >.<
PHP
686
star
3

dbad

Dont Be a Dick Public License
HTML
529
star
4

codeigniter-template

Template library for CodeIgniter which supports modules, themes, partial views, etc.
HTML
411
star
5

codeigniter-curl

THIS IS NO LONGER MAINTAINED, USE http://docs.guzzlephp.org INSTEAD
PHP
377
star
6

codeigniter-oauth2

NO LONGER ACTIVELY MAINTAINED. USE https://github.com/thephpleague/oauth2-client INSTEAD
PHP
352
star
7

phptherightway-book

The official eBook version of phptherightway.com. Download in PDF/mobi/epub formats from LeanPub.
PHP
126
star
8

codeigniter-cli

Work with CodeIgniter over the command line with handy prompts, clear screen, etc.
PHP
97
star
9

codeigniter-oauth

NO LONGER ACTIVELY MAINTAINED. USE https://github.com/thephpleague/oauth1-client INSTEAD
PHP
84
star
10

codeigniter-unzip

Extract ZIP files in CodeIgniter without installing any PECL extensions for PHP.
PHP
78
star
11

ee2-rest

Integrate RESTful API's into your ExpressionEngine 2.0 website with this Rest module.
PHP
34
star
12

coffeescript-beautifier

Format your coffeescript to make it more beautiful
29
star
13

codeigniter-dwoo

A simple Dwoo template engine implementation for CodeIgniter via Parser library.
PHP
27
star
14

nonblockingbro

Debunking an article suggesting that NodeJS was magically faster than PHP at scraping HTML and traversing the DOM, but used blocking code for one and non-blocking for another.
PHP
25
star
15

livecoding-apisyouwonthate

HTML
24
star
16

codeigniter-prowl

Send iPhone notificiations from your CodeIgniter application with Prowl.
PHP
23
star
17

ee2-widgets

Widgets is a ExpressionEngine 2.1 module that allows even your least experienced client or to manage chunks of intelligent content on there site without needing to learn loads of tags, HTML or call you in to help.
PHP
18
star
18

codeigniter-encoding

A simple library for interacting with the Encoding.com service, allowing you to que audio and video files which they will take, convert and put onto a FTP server.
PHP
17
star
19

tech-talks

Talks for conferences, meetups, corporate gigs, whatever.
HTML
14
star
20

php-ps

PHP Portable Shell
14
star
21

fuelphp-gettingstarted

Code samples for "Getting Started with FuelPHP: Part 2"
PHP
12
star
22

phparse

Parse phpinfo() HTML with PHP
PHP
11
star
23

phil.tech

Computers, humans, the overlap, and remote work.
10
star
24

codeigniter-maxcdn

PHP
9
star
25

book-full-bike-bike-nomad

A book about blowing everything up and starting again over two plus years of being a bike nomad. 34 countries, nowhere to call home, working full time as a software engineer, trying to keep my electronics dry/powered/not stolen, and my carbon footprint super low.
6
star
26

go-workshop

Go
5
star
27

mojo-variables

Set variables in your layout file or anywhere throughout Mojo Regions then use them again anywhere.
PHP
5
star
28

remotefloatsmyboat.com

Collection of reasons why people love working remote, which started before COVID but has only become more true now with the mental wellbeing crisis.
Smarty
4
star
29

openapi-playground

HTML
3
star
30

spectral-demo-circleci

2
star
31

photo-unfucker

Take disorganized files and move them into a nested date directory structure
Ruby
2
star
32

openapi-schema-to-json-schema

2
star
33

mojo-inputs

Get access to GET, POST and Cookie data. Also gives you the users ip address and user agent.
PHP
2
star
34

psr0-naming-oddity

This highlights an oddity in PSR-0 which will cause errors if you instantiate classes inconsistently
PHP
2
star
35

api-design-workshop

2
star
36

go-workshop-php

PHP
2
star
37

covidclimate.com

As the world focuses on tackling COVID-19, we must not forget: this wonโ€™t be the last pandemic we suffer.
Smarty
2
star
38

projects

Direct funding for biodiverstiy and carbon sequestration projects for Protect Earth and anyone else who wants to use this open-source software.
2
star
39

tutorial-api-docs-first

API Blueprint
1
star
40

examples-examples

1
star
41

phil.bike

The two-wheeled adventures of Crash MyCiderface
1
star
42

laravel-zuplo-demo

Taking a laravel application and protecting it with the Zuplo API Gateway.
PHP
1
star