[Bps-public-commit] rt-authen-token branch, master, updated. 02a3d67da059b6b573a3a3bd23b50950adb29c12

Shawn Moore shawn at bestpractical.com
Mon Jul 10 08:58:50 EDT 2017


The branch, master has been updated
       via  02a3d67da059b6b573a3a3bd23b50950adb29c12 (commit)
      from  da524e2538d209af1ce6f954029d13980f0a1cbd (commit)

Summary of changes:
 html/Callbacks/RT-Authen-Token/autohandler/Session | 5 +++++
 1 file changed, 5 insertions(+)

- Log -----------------------------------------------------------------
commit 02a3d67da059b6b573a3a3bd23b50950adb29c12
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Jul 10 12:58:02 2017 +0000

    Allow Authorization header to specify auth token
    
    This lets REST1 use token auth:
    
        curl -H 'Authorization: token 1-14-...' /REST/1.0/user/root

diff --git a/html/Callbacks/RT-Authen-Token/autohandler/Session b/html/Callbacks/RT-Authen-Token/autohandler/Session
index 38c3ca3..38a28fa 100644
--- a/html/Callbacks/RT-Authen-Token/autohandler/Session
+++ b/html/Callbacks/RT-Authen-Token/autohandler/Session
@@ -4,6 +4,11 @@ $pass => ''
 </%ARGS>
 <%INIT>
 return if RT::Interface::Web::_UserLoggedIn();
+
+if ((RT::Interface::Web::RequestENV('HTTP_AUTHORIZATION')||'') =~ /^token (.*)$/i) {
+    $pass ||= $1;
+}
+
 return unless defined $pass;
 
 my ($user_obj, $token) = RT::Authen::Token->UserForAuthString($pass, $user);

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list