Skip to content
Permalink
Browse files

Item11267: Update extension topic, check api ver.

This extension needs Foswiki 1.2  features for enforcing REST security.
Don't  register the REST handler unless API 2.3 is available.
  • Loading branch information...
gac410 committed Aug 20, 2014
1 parent b04ffc3 commit 1547170aea350712709dc7dd5e96f8e7f29e574b
Showing with 31 additions and 12 deletions.
  1. +10 −5 data/System/FoswikiOrgPlugin.txt
  2. +21 −7 lib/Foswiki/Plugins/FoswikiOrgPlugin.pm
@@ -1,31 +1,36 @@
%META:TOPICINFO{author="ProjectContributor" date="1401067543" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1408579046" format="1.1" version="1"}%
%META:TOPICPARENT{name="Plugins"}%
<!--
One line description, required for extensions repository catalog.
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->
---+!! Empty Plugin
---+!! !FoswikiOrg Plugin

%SHORTDESCRIPTION%

%TOC%

Implements Foswiki.org specific hooks and processing.

* REST handler to update tasks from notification of push events. Requires a secret key shared with http://github.com/
* beforeSaveHandler eventually implements automatic security controls on Tasks.

---++ Preferences

Configuration is done witin =bin/configure=. See configure for documentation.

---++ Installation
%$INSTALL_INSTRUCTIONS%

---++ Info

| Author: | ProjectContributor |
| Copyright: | %$CREATEDYEAR%, ProjectContributor, All Rights Reserved |
| Author: | GeorgeClark |
| Copyright: | 2014, ProjectContributor, All Rights Reserved |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Dependencies: | %$DEPENDENCIES% |
| Version: | %$VERSION% |
| Release: | %$RELEASE% |
| Change&nbsp;History: | <!-- versions below in reverse order -->&nbsp; |
| 1.0 (%$CREATEDATE%): | Initial version |
| 1.0 (2014-08-20): | Initial version |
| Home: | http://foswiki.org/Extensions/%TOPIC% |
| Support: | http://foswiki.org/Support/%TOPIC% |
@@ -16,14 +16,28 @@ our $NO_PREFS_IN_TOPIC = 1;

# Plugin init method, used to initialise handlers
sub initPlugin {
Foswiki::Func::registerRESTHandler(
'githubpush', \&_RESTgithubpush,
validate => 0, # No strikeone applicable
authenticate => 0, # Github push provides a security token for checking
http_allow => 'GET,POST', # Github only will POST.
description =>

# check for Plugins.pm versions, don't register REST handler
# on older versions of Foswiki.
if ( $Foswiki::Plugins::VERSION < 2.3 ) {
Foswiki::Func::writeWarning(
'Version mismatch between ',
__PACKAGE__,
' and Plugins.pm, skipping REST Handler'
);
}
else {
Foswiki::Func::registerRESTHandler(
'githubpush', \&_RESTgithubpush,
validate => 0, # No strikeone applicable
authenticate =>
0, # Github push provides a security token for checking
http_allow => 'POST', # Github only will POST.
description =>
'Handle webhook push requests from GitHub. Secured by HMAC hash of payload with shared secret.'
);
);
}

return 1;
}

0 comments on commit 1547170

Please sign in to comment.
You can’t perform that action at this time.