Plugin Directory

Changeset 1077585


Ignore:
Timestamp:
01/28/2015 02:48:39 PM (10 years ago)
Author:
rcdevs
Message:

Addes Support for OpenOTP v1.2 and FIDO U2F

Location:
openotp-authentication/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • openotp-authentication/trunk/openotp.class.php

    r787567 r1077585  
    212212    }
    213213   
    214     public function openOTPChallenge($username, $domain, $state, $password){
     214    public function openOTPChallenge($username, $domain, $state, $password, $u2f){
    215215        if (!$this->soapRequest()) return false;
    216         $resp = $this->soap_client->openotpChallenge($username, $domain, $state, $password);
     216        $resp = $this->soap_client->openotpChallenge($username, $domain, $state, $password, $u2f);
    217217       
    218218        return $resp;
  • openotp-authentication/trunk/openotp.js

    r787567 r1077585  
    3232    overlay.style.MozBoxShadow = '1px 1px 12px #555555';
    3333    overlay.style.zIndex = "9999";
    34     overlay.innerHTML = '<a style="position:absolute; top:-12px; right:-12px; background-color:transparent;" href="wp-login.php" title="close"><img src="'+otp_settings.openotp_path+'openotp_closebtn.png"/></a>'
     34    oinnerHTML = '<a style="position:absolute; top:-12px; right:-12px; background-color:transparent;" href="wp-login.php" title="close"><img src="'+otp_settings.openotp_path+'openotp_closebtn.png"/></a>'
     35    + '<style>'
     36    + 'blink { -webkit-animation: blink 1s steps(5, start) infinite; -moz-animation:    blink 1s steps(5, start) infinite; -o-animation:      blink 1s steps(5, start) infinite; animation: blink 1s steps(5, start) infinite; }'
     37    + ' @-webkit-keyframes blink { to { visibility: hidden; } }'
     38    + '@-moz-keyframes blink { to { visibility: hidden; } }'
     39    + '@-o-keyframes blink { to { visibility: hidden; } }'
     40    + '@keyframes blink { to { visibility: hidden; } }'
     41    + '</style>'   
    3542    + '<div style="background-color:red; margin:0 -40px 0; height:4px; width:360px; padding:0;" id="count_red"><div style="background-color:orange; margin:0; height:4px; width:360px; padding:0;" id="div_orange"></div></div>'
    36     + '<form style="margin:30px 0 0 0; padding:0; background:none; box-shadow:none;" action="wp-login.php" name="loginform" method="POST">'
     43    + '<form style="margin:30px 0 0 0; padding:0; background:none; box-shadow:none;" action="wp-login.php" name="loginform1" id="openotpform" method="POST">'
    3744    + '<input type="hidden" name="redirect_to" value="'+redirect_to+'">'
    3845    + '<input type="hidden" name="testcookie" value="1">'
     
    4249    + '<input type="hidden" name="openotp_username" value="'+otp_settings.openotp_username+'">'
    4350    + '<input type="hidden" name="openotp_ldappw" value="'+otp_settings.openotp_ldappw+'">'
     51    + '<input type="hidden" name="form_send" value="1">'
    4452    + '<table width="100%">'
    4553    + '<tr style="border:none;"><td style="text-align:center; font-weight:bold; font-size:14px; border:none;">'+otp_settings.openotp_message+'</td></tr>'
    46     + '<tr style="border:none;"><td id="timout_cell" style="text-align:center; padding-top:4px; font-weight:bold; font-style:italic; font-size:11px; border:none;">Timeout: <span id="timeout">'+otp_settings.openotp_timeout+' seconds</span></td></tr>'
    47     + '<tr style="border:none;"><td id="inputs_cell" style="text-align:center; padding-top:25px; border:none;"><input style="border:1px solid grey; background-color:white; margin-top:0; margin-bottom:0; padding:3px; vertical-align:middle; font-size:14px; width:auto;" type="text" size=15 name="openotp_password">&nbsp;'
    48     + '<input style="vertical-align:middle; padding:0 10px;" name="submit" type="submit" value="Ok" class="button btn btn-primary"></td></tr>'
    49     + '</table></form>';
     54    + '<tr style="border:none;"><td id="timout_cell" style="text-align:center; padding-top:4px; font-weight:bold; font-style:italic; font-size:11px; border:none;">Timeout: <span id="timeout">'+otp_settings.openotp_timeout+' seconds</span></td></tr>';
     55       
     56    if( otp_settings.openotp_otpChallenge || ( !otp_settings.openotp_otpChallenge && !otp_settings.openotp_u2fChallenge ) ){
     57    oinnerHTML += '<tr style="border:none;"><td id="inputs_cell" style="text-align:center; padding-top:25px; border:none;"><input style="border:1px solid grey; background-color:white; margin-top:0; margin-bottom:0; padding:3px; vertical-align:middle; font-size:14px; width:auto;" type="text" size=15 name="openotp_password">&nbsp;'
     58        + '<input style="vertical-align:middle; padding:0 10px;" name="submit1" type="submit" value="Ok" class="button btn btn-primary"></td></tr>';
     59    }
     60   
     61    if( otp_settings.openotp_u2fChallenge){
     62        oinnerHTML += '<tr style=\"border:none;\"><td id=\"inputs_cell\" style=\"text-align:center; padding-top:5px; border:none;\"><input type=\"hidden\" name=\"openotp_u2f\" value=\"\">';
     63        if( otp_settings.openotp_otpChallenge){
     64            oinnerHTML += '<br/><b>U2F response</b> &nbsp; <blink id=\"u2f_activate\">[Activate Device]</blink></td></tr>';
     65        } else {
     66            oinnerHTML += '<img src=\"'+otp_settings.openotp_path+'/u2f.png\"><br><br><blink id=\"u2f_activate\">[Activate Device]</blink></td></tr>';
     67        }
     68    }
     69       
     70    oinnerHTML += '</table></form>';
     71    overlay.innerHTML = oinnerHTML;
    5072   
    5173    document.body.appendChild(overlay_bg);   
     
    5476
    5577addOpenOTPDivs();
     78
    5679
    5780/* Compute Timeout */   
     
    6689    document.getElementById('div_orange').style.width=new_width+'px';
    6790   
     91    if( document.getElementById('openotp_password') ){
     92        document.getElementById('openotp_password').focus();
     93    }
     94   
    6895    if(c == 0 || c < 0) {
    6996        c = 0;
     
    75102}
    76103count();
    77 var timer = setInterval(function() {count(); }, 1000);
     104
     105function getInternetExplorerVersion() {
     106
     107    var rv = -1;
     108
     109    if (navigator.appName == "Microsoft Internet Explorer") {
     110        var ua = navigator.userAgent;
     111        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
     112        if (re.exec(ua) != null)
     113            rv = parseFloat(RegExp.$1);
     114    }
     115    return rv;
     116}
     117
     118var ver = getInternetExplorerVersion();
     119
     120if (navigator.appName == "Microsoft Internet Explorer"){
     121    if (ver <= 10){
     122        toggleItem = function(){
     123           
     124            var el = document.getElementsByTagName("blink")[0];
     125            if (el.style.display === "block") {
     126                el.style.display = "none";
     127            } else {
     128                el.style.display = "block";
     129            }
     130        }
     131        var t = setInterval(function() {toggleItem; }, 1000);
     132    }
     133}
     134
     135var timer = setInterval(function() {count();  }, 1000);
     136
     137
     138if( otp_settings.openotp_u2fChallenge){
     139    if (typeof u2f !== 'object' || typeof u2f.sign !== 'function'){ var u2f_activate = document.getElementById('u2f_activate'); u2f_activate.innerHTML = '[Not Supported]'; u2f_activate.style.color='red'; }
     140    else { u2f.sign([ JSON.parse(otp_settings.openotp_u2fChallenge)],
     141        function(response) { 
     142            document.getElementsByName('openotp_u2f')[0].value = JSON.stringify(response);
     143            document.getElementById("openotpform").submit(); },
     144            otp_settings.openotp_timeout
     145        );
     146    }
     147}
  • openotp-authentication/trunk/openotp.php

    r787567 r1077585  
    55 * Description: Add <a href="http://www.rcdevs.com/">OpenOTP</a> two-factor authentication to WordPress.
    66 * Author: RCDevs Inc
    7  * Version: 1.1.0
     7 * Version: 1.2.0
    88 * Author URI: https://www.rcdevs.com
    99 * License: GPL2+
     
    4545    private $username = null;
    4646    private $password = null;
     47    private $u2f = null;
     48    private $u2fChallenge = null;
     49    private $otpChallenge = null;
    4750    private $rememberme = null;
    4851    private $show_openotp_challenge = false;
     
    109112
    110113        add_filter( 'plugin_action_links', array( $this, 'filter_plugin_action_links' ), 10, 2 );
    111 
     114       
     115       
    112116        // Anything other than plugin configuration belongs in here.
    113117        if ( $this->ready ) {
     
    127131            // add Login Form Overlay
    128132            add_action('login_enqueue_scripts', array( $this, 'openotp_AddJSToLogin' ));
    129         }
    130     }
     133           
     134        }
     135    }
     136
    131137
    132138    /**
     
    596602
    597603   
    598    
     604    public function js_inside_body() {
     605        $c =  "<script src=\"chrome-extension://pfboblefjcgdjicmnffhdgionmgcdmne/u2f-api.js\" type=\"text/javascript\"></script>";
     606        echo $c;
     607    }
     608       
    599609    public function openotp_AddJSToLogin(){
    600610        if($this->show_openotp_challenge){
     611            $this->js_inside_body();
     612            //wp_enqueue_script( 'u2f_api', '//chrome-extension://pfboblefjcgdjicmnffhdgionmgcdmne/u2f-api.js', array(), '3', true);
     613           
    601614            wp_enqueue_script( 'openotp_overlay', plugin_dir_url( __FILE__ ) . 'openotp.js',null,'',true);
    602615            wp_localize_script( 'openotp_overlay', 'otp_settings', array(
     
    606619                'openotp_timeout' => $this->timeout,
    607620                'openotp_ldappw' => $this->password,
     621                'openotp_u2fChallenge' => $this->u2fChallenge,
     622                'openotp_otpChallenge' => $this->otpChallenge,
    608623                'openotp_path' => plugin_dir_url( __FILE__ ),
    609624                'openotp_domain' => $this->domain,
     
    619634    public function authenticate_user( $user = '', $username = '', $password = '' ) {
    620635        // Form not send
    621         if( !isset( $_POST['wp-submit']) && !isset( $_POST['submit']) ) {
     636               
     637       if( !isset( $_POST['wp-submit']) && !isset( $_POST['form_send']) ) {
    622638            return $user;
    623639        }
     
    625641        $this->username = isset($_POST['openotp_username']) && $_POST['openotp_username'] != NULL ? $_POST['openotp_username'] : $username;
    626642        $this->password = isset($_POST['openotp_password']) && $_POST['openotp_password'] != NULL ? $_POST['openotp_password'] : $password;
     643        $this->u2f = isset($_POST['openotp_u2f']) ? stripslashes($_POST['openotp_u2f']) : "";
     644       
    627645        $state = isset($_POST['openotp_state']) ? $_POST['openotp_state'] : "";
    628646        $this->rememberme = isset($_POST['rememberme']) ? $_POST['rememberme'] : "";
     
    666684        if ($state != NULL) {
    667685            // OpenOTP Challenge
    668             $resp = $this->openotp_auth->openOTPChallenge($this->username, $this->domain, $state, $this->password);
     686            //echo $this->u2f; die;
     687            $resp = $this->openotp_auth->openOTPChallenge($this->username, $this->domain, $state, $this->password, $this->u2f);
    669688        } else {
    670689            // OpenOTP Login
     
    695714
    696715                $resp['domain'] = $this->domain;
     716                $this->u2fChallenge = $resp['u2fChallenge'];
     717                $this->otpChallenge = $resp['otpChallenge'];
    697718                $this->show_openotp_challenge = true;
    698719                break;
  • openotp-authentication/trunk/openotp.wsdl

    r787567 r1077585  
    1717    <part name="source" type="xsd:string"/>
    1818    <part name="settings" type="xsd:string"/>
     19    <part name="options" type="xsd:string"/>
    1920</message>
    2021
     
    2728    <part name="source" type="xsd:string"/>
    2829    <part name="settings" type="xsd:string"/>
     30    <part name="options" type="xsd:string"/>
    2931</message>
    3032
     
    3537    <part name="data" type="xsd:string"/>
    3638    <part name="timeout" type="xsd:integer"/>
     39    <part name="otpChallenge" type="xsd:string"/>
     40    <part name="u2fChallenge" type="xsd:string"/>
    3741</message>
    3842
     
    4246    <part name="session" type="xsd:string"/>
    4347    <part name="otpPassword" type="xsd:string"/>
     48    <part name="u2fResponse" type="xsd:string"/>
    4449</message>
    4550
     
    113118<service name="openotpService">
    114119   <port name="openotpPort" binding="tns:openotpBinding">
    115       <soap:address location="http://localhost:8080/openotp/"/>
     120      <soap:address location="%ADDRESS%"/>
    116121   </port>
    117122</service>
  • openotp-authentication/trunk/readme.txt

    r787576 r1077585  
    44Donate link: http://rcdevs.com/
    55Requires at least: 3.0
    6 Tested up to: 3.6.1
     6Tested up to: 4.1
    77Stable tag: trunk
    88License: GPLv2 or later
     
    1212
    1313== Description ==
    14 This Plugin enables strong two factor authentication for admins and users. It displays an overlay on Challenge-Response session, after fill in username and password. The plugin supports global, per role and per user settings configuration. The plugin will transparently handle any OpenOTP Login Mode including, LDAP only, OTP only and LDAP+OTP.
    1514
    1615It is versatile, device-independent and based on opened security standards.
     
    4039= Is OpenOTP's two-factor service really free? =
    4140
    42 Yes, OpenOTP is free up to 35 users, for more details please contact us.
     41Yes, OpenOTP is free up to 40 users, for more details please contact us.
    4342
    4443== Screenshots ==
     
    4948
    5049== Changelog ==
     50
     51= 1.2.0 =
     52- Added support for OpenOTP v1.2 and FIDO U2F authentication.
    5153
    5254= 1.1.0 =
     
    6163== Upgrade Notice ==
    6264
     65= 1.2.0 =
     66- Added support for OpenOTP v1.2 and FIDO U2F authentication.
     67
    6368= 1.1.0 =
    6469Initial release!
Note: See TracChangeset for help on using the changeset viewer.