Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
- Plugin basic structure
- Added new login route to the API
- Added Firebase/jwt-auth
  • Loading branch information
Tmeister committed Jul 29, 2015
0 parents commit dc20a91
Show file tree
Hide file tree
Showing 48 changed files with 2,873 additions and 0 deletions.
339 changes: 339 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# JSON Web Token Authentication for WP-API
Add the ability to authenticate the API calls using JWT to the WP-API

## Work in Progress incomplete development
103 changes: 103 additions & 0 deletions admin/class-jwt-auth-admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php

/**
* The admin-specific functionality of the plugin.
*
* @link https://enriquechavez.co
* @since 1.0.0
*
* @package Jwt_Auth
* @subpackage Jwt_Auth/admin
*/

/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package Jwt_Auth
* @subpackage Jwt_Auth/admin
* @author Enrique Chavez <[email protected]>
*/
class Jwt_Auth_Admin {

/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;

/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;

/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {

$this->plugin_name = $plugin_name;
$this->version = $version;

}

/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {

/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Jwt_Auth_Loader as all of the hooks are defined
* in that particular class.
*
* The Jwt_Auth_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/

wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/jwt-auth-admin.css', array(), $this->version, 'all' );

}

/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {

/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Jwt_Auth_Loader as all of the hooks are defined
* in that particular class.
*
* The Jwt_Auth_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/

wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jwt-auth-admin.js', array( 'jquery' ), $this->version, false );

}

}
4 changes: 4 additions & 0 deletions admin/css/jwt-auth-admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* All of the CSS for your admin-specific functionality should be
* included in this file.
*/
1 change: 1 addition & 0 deletions admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden
32 changes: 32 additions & 0 deletions admin/js/jwt-auth-admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(function( $ ) {
'use strict';

/**
* All of the code for your admin-specific JavaScript source
* should reside in this file.
*
* Note that this assume you're going to use jQuery, so it prepares
* the $ function reference to be used within the scope of this
* function.
*
* From here, you're able to define handlers for when the DOM is
* ready:
*
* $(function() {
*
* });
*
* Or when the window is loaded:
*
* $( window ).load(function() {
*
* });
*
* ...and so on.
*
* Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler
* for any particular page. Though other scripts in WordPress core, other plugins, and other themes may
* be doing this, we should try to minimize doing that in our own work.
*/

})( jQuery );
16 changes: 16 additions & 0 deletions admin/partials/jwt-auth-admin-display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* Provide a admin area view for the plugin
*
* This file is used to markup the admin-facing aspects of the plugin.
*
* @link https://enriquechavez.co
* @since 1.0.0
*
* @package Jwt_Auth
* @subpackage Jwt_Auth/admin/partials
*/
?>

<!-- This file should primarily consist of HTML with a little bit of PHP. -->
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"config": {
"vendor-dir": "includes/vendor"
},
"require": {
"firebase/php-jwt": "^3.0"
}
}
61 changes: 61 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions includes/class-jwt-auth-activator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* Fired during plugin activation
*
* @link https://enriquechavez.co
* @since 1.0.0
*
* @package Jwt_Auth
* @subpackage Jwt_Auth/includes
*/

/**
* Fired during plugin activation.
*
* This class defines all code necessary to run during the plugin's activation.
*
* @since 1.0.0
* @package Jwt_Auth
* @subpackage Jwt_Auth/includes
* @author Enrique Chavez <[email protected]>
*/
class Jwt_Auth_Activator {

/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function activate() {

}

}
36 changes: 36 additions & 0 deletions includes/class-jwt-auth-deactivator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* Fired during plugin deactivation
*
* @link https://enriquechavez.co
* @since 1.0.0
*
* @package Jwt_Auth
* @subpackage Jwt_Auth/includes
*/

/**
* Fired during plugin deactivation.
*
* This class defines all code necessary to run during the plugin's deactivation.
*
* @since 1.0.0
* @package Jwt_Auth
* @subpackage Jwt_Auth/includes
* @author Enrique Chavez <[email protected]>
*/
class Jwt_Auth_Deactivator {

/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function deactivate() {

}

}
63 changes: 63 additions & 0 deletions includes/class-jwt-auth-i18n.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

/**
* Define the internationalization functionality
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @link https://enriquechavez.co
* @since 1.0.0
*
* @package Jwt_Auth
* @subpackage Jwt_Auth/includes
*/

/**
* Define the internationalization functionality.
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @since 1.0.0
* @package Jwt_Auth
* @subpackage Jwt_Auth/includes
* @author Enrique Chavez <[email protected]>
*/
class Jwt_Auth_i18n {

/**
* The domain specified for this plugin.
*
* @since 1.0.0
* @access private
* @var string $domain The domain identifier for this plugin.
*/
private $domain;

/**
* Load the plugin text domain for translation.
*
* @since 1.0.0
*/
public function load_plugin_textdomain() {

load_plugin_textdomain(
$this->domain,
false,
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
);

}

/**
* Set the domain equal to that of the specified domain.
*
* @since 1.0.0
* @param string $domain The domain that represents the locale of this plugin.
*/
public function set_domain( $domain ) {
$this->domain = $domain;
}

}
Loading

0 comments on commit dc20a91

Please sign in to comment.