auth0/wp-jwt-auth

Name: wp-jwt-auth

Owner: Auth0

Description: [DEPRECATED] This plugin targets to add JWT authentication to Wordpress API's provided by plugins.

Created: 2015-04-28 21:27:43.0

Updated: 2018-01-22 15:01:02.0

Pushed: 2017-11-28 14:15:54.0

Homepage: http://auth0.com

Size: 208

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

DEPRECATED - This library is no longer maintained/supported.

This library was built as an example for a session in a PHP conference, and is no longer supported.

Wordpress JWT Authentication

Authenticate your APIs with JWT easily.

Configuration
How it works

This plugin will check the headers of the requests and if there is an Authorization header will try to log in a user that matches. So it is as easy to check for the current user to authenticate users in your own API.

Also, it provides support for the following plugins:

And any other that extends Wp Rest Api like http://tweichart.github.io/JSON-API-for-BuddyPress/ for BuddyPress.

Overriding the User Repository logic

The user repository is the responsible of retriving the user based on the JWT. By default, it looks in the user database to match the User Property and the JWT Attribute.

If you need to override the way the user matching is made (ie: you need to look to another table in the database) you can create your own User Repostory and match the user as you need.

To accomplish this, you need to add a filter:

add_filter( 'wp_jwt_auth_get_user', array( __CLASS__, 'get_user' ),10);

To see an example, check the UsersRepo.

When the plugin is using a User Repository the User Property and JWT Property settings are ignored.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.