-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e49e5ba
Showing
18 changed files
with
1,688 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "mundanity/oauth2server", | ||
"description": "A lightweight OAuth2 server for Drupal", | ||
"homepage": "https://github.com/mundanity/oauth2server", | ||
"authors": [ | ||
{ | ||
"name": "Owen Loy", | ||
"email": "[email protected]", | ||
"homepage": "http://www.mundanity.com" | ||
} | ||
], | ||
"license": "MIT", | ||
"require": { | ||
"php": "~5.5", | ||
"mundanity/drupal-logger": "~1.0.0", | ||
"league/oauth2-server": "~4.1.2" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~4.5.0" | ||
}, | ||
"repositories": [ | ||
{ | ||
"type": "vcs", | ||
"url": "https://github.com/mundanity/drupal-logger.git" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": {"Drupal\\oauth2server\\": "src/"} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* Administrative configuration form. | ||
* | ||
*/ | ||
function oauth2server_admin_form($form, &$form_state) { | ||
|
||
$form['oauth2server_access_token_ttl'] = [ | ||
'#type' => 'textfield', | ||
'#size' => 10, | ||
'#title' => t('Access token TTL'), | ||
'#description' => t('The time (in seconds) a provisioned access token will be valid for (default 3600s).'), | ||
'#default_value' => variable_get('oauth2server_access_token_ttl', 3600), | ||
]; | ||
$form['oauth2server_is_authorization_server'] = [ | ||
'#type' => 'checkbox', | ||
'#title' => t('Enable authorization server.'), | ||
'#description' => t('If enabled, this Drupal site will act as an authorization server, and provide an "access_token" endpoint.'), | ||
'#default_value' => variable_get('oauth2server_is_authorization_server', TRUE), | ||
]; | ||
|
||
return system_settings_form($form); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/** | ||
* Implements hook_drush_command(). | ||
* | ||
*/ | ||
function oauth2server_drush_command() { | ||
|
||
$items['oauth2server-expire-tokens'] = [ | ||
'description' => dt('Expires access tokens, refresh tokens, and authorization codes.'), | ||
'aliases' => ['oauth2server-expire'], | ||
]; | ||
|
||
return $items; | ||
|
||
} | ||
|
||
|
||
/** | ||
* Expires access tokens, refresh tokens, and authorization codes. | ||
* | ||
*/ | ||
function drush_oauth2server_expire_tokens() { | ||
|
||
$count = oauth2server_expire_tokens(); | ||
|
||
drush_log(dt('Expired !count access tokens', ['!count' => $count->access_tokens]), 'ok'); | ||
drush_log(dt('Expired !count refresh tokens', ['!count' => $count->refresh_tokens]), 'ok'); | ||
drush_log(dt('Expired !count authorization codes', ['!count' => $count->auth_codes]), 'ok'); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name = "OAuth2 Server" | ||
description = "Theoretically lightweight OAuth2 server" | ||
core = 7.x | ||
php = 5.5 | ||
|
||
dependencies[] = restapi | ||
dependencies[] = xautoload |
Oops, something went wrong.