Skip to content

Commit

Permalink
Item14459: Initial import of TWiki code with some modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Aug 17, 2017
0 parents commit bcf32e8
Show file tree
Hide file tree
Showing 19 changed files with 926 additions and 0 deletions.
Empty file added TIDY
Empty file.
42 changes: 42 additions & 0 deletions data/System/SmsTwoStepAuthContrib.txt
@@ -0,0 +1,42 @@
<!--
One line description, required for extensions repository catalog.
* Set SHORTDESCRIPTION = Provide NTLM authentication for Net::SMTP e-mail from Foswiki
-->
---+!! SmsTwoStepLoginContrib

%SHORTDESCRIPTION%

%TOC%

---++ Installation
%$INSTALL_INSTRUCTIONS%

This contrib is used by Wiki administrators, and is not directly relevant to ordinary users.

It applies to installations using the Net::SMTP email method for Foswiki-originated e-mail,
and does not apply to those installations using sendmail or another mail program to send mail.

Simply install this contrib to enable Foswiki email originated by Net::SMTP to use servers
that require NTLM (Microsoft Windows) authentication.

When the contrib has been installed, specify the Windows credentials in Configure under
{SMTP}Username and {SMTP}{Password}. To specify a domain name, enter it in the Username
field as domain\username.

Although not recommended and insecure, you can prefix the username with V1: (e.g. V1:domain\user
or V1:user) to requrest NTLMv1 authentication.


---++ Info

| Author: | Foswiki:Main.TimotheLitt |
| Copyright &copy;: 2012, Timothe Litt, All Rights Reserved |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Dependencies: | %$DEPENDENCIES% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 1.0 (27 Dec 2012): | Initial version |
| Home: | http://foswiki.org/Extensions/%TOPIC% |
| Support: | http://foswiki.org/Support/%TOPIC% |


48 changes: 48 additions & 0 deletions lib/Foswiki/Contrib/SmsTwoStepAuthContrib.pm
@@ -0,0 +1,48 @@
# See bottom of file for default license and copyright information

=begin TML
---+ package Foswiki::Contrib::SmsTwoStepLoginContrib
This is a stub module for a new contrib . Customise this module as required .
=cut

package Foswiki::Contrib::SmsTwoStepLoginContrib;

# Always use strict to enforce variable scoping
use strict;
use warnings;

our $VERSION = '1.0';
our $RELEASE = '1.0';

our $SHORTDESCRIPTION =
'Provide 2-factor login authentication using SMS messages.';

1;

__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Author: George Clark, Peter Thoeny
Copyright (C) 2017 Foswiki Contributors, All rights reserved.
Copyright (C) 2014 Wave Systems Corp.
Copyright (C) 2014-2016 Peter Thoeny, peter[at]thoeny.org
Copyright (C) 2014-2016 TWiki Contributors. All Rights Reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details, published at
http://www.gnu.org/copyleft/gpl.html
As per the GPL, removal of this notice is prohibited.
64 changes: 64 additions & 0 deletions lib/Foswiki/Contrib/SmsTwoStepAuthContrib/Config.spec
@@ -0,0 +1,64 @@
# ---+ Extensions
# ---++ SMS Two-Step Auth Contrib
# This is the configuration of the <b>SmsTwoStepAuthContrib</b>.

# **STRING 80**
# White-listed IP addresses. Specify a comma-space separated list. Partial IP addresses
# ending in a dot can be used to specify a range. Example: <tt>1.2.3.4, 5.6.7.</tt>
$Foswiki::cfg{SmsTwoStepAuthContrib}{WhitelistAddresses} = '';

# **NUMBER**
# Maximum age of access code in seconds, default is 600 (10 min).
$Foswiki::cfg{SmsTwoStepAuthContrib}{MaxAge} = 600;

# **SELECT off, optional, required**
# Mode of two-step authentication:
# <ul> <li> <tt>disabled</tt>: Single step authentication.
# </li> <li> <tt>optional</tt>: Optional, e.g. user can chose. <b><i>Attention:</i></b>
# The UserForm and UserProfileHeader need to be updated - see installation instructions.
# </li> <li> <tt>required</tt>: Required for all users. (default)
# </li> </ul>
$Foswiki::cfg{SmsTwoStepAuthContrib}{TwoStepAuth} = 'required';

# **STRING 80**
# It is possible to send the access code by e-mail instead of SMS if the user has not
# specified a mobile number and a carrier. Possible values:
# <ul> <li> <tt>0</tt> or empty value: No e-mail sent, user cannot login (more secure).
# </li> <li> <tt>1</tt>: Users with missing mobile and carrier get an e-mail with access
# code (more flexible).
# </li> <li> List of users: Specify a comma-space separated list of WikiWord names of
# users who can get an e-mail. Examples:
# <br /> <tt>JimmyNeutron</tt> - only one specified user
# <br /> <tt>JimmyNeutron, DonaldDuck</tt> - only two specified users
# </li> </ul>
$Foswiki::cfg{SmsTwoStepAuthContrib}{AllowEmail} = '';

# **STRING 80**
# Name of two-step message template for SMS message, default 'smstwostepmessage'.
$Foswiki::cfg{SmsTwoStepAuthContrib}{SmsMessageTmpl} = 'smstwostepmessage';

# **STRING 80**
# Name of log-in screen template for SMS log-in, default 'smstwosteplogin'.
$Foswiki::cfg{SmsTwoStepAuthContrib}{SmsLoginTmpl} = 'smstwosteplogin';

# **STRING 80**
# Name of two-step message template for e-mail message, default 'smstwostepemailmessage'.
$Foswiki::cfg{SmsTwoStepAuthContrib}{EmailMessageTmpl} = 'smstwostepemailmessage';

# **STRING 80**
# Name of log-in screen template for e-mail log-in, default 'smstwostepemaillogin'.
$Foswiki::cfg{SmsTwoStepAuthContrib}{EmailLoginTmpl} = 'smstwostepemaillogin';

# **STRING 80**
# Name of log-in screen template in case of insufficient credentials, default 'smstwosteperrorlogin'.
$Foswiki::cfg{SmsTwoStepAuthContrib}{ErrorLoginTmpl} = 'smstwosteperrorlogin';

# **STRING 80**
# Access code error message.
$Foswiki::cfg{SmsTwoStepAuthContrib}{AcessCodeError} = 'Invalid or outdated access code, please try again.';

# **BOOLEAN**
# Debug flag - see output in <code>twiki/data/debug.txt</code>.
$Foswiki::cfg{SmsTwoStepAuthContrib}{Debug} = 0;

1;
Empty file.
16 changes: 16 additions & 0 deletions lib/Foswiki/Contrib/SmsTwoStepAuthContrib/MANIFEST
@@ -0,0 +1,16 @@
data/System/SmsTwoStepAuthContrib.txt 0644
lib/Foswiki/Contrib/SmsTwoStepAuthContrib.pm 0644
lib/Foswiki/Contrib/SmsTwoStepAuthContrib/Config.spec 0644
lib/Foswiki/Contrib/SmsTwoStepAuthContrib/DEPENDENCIES 0644
lib/Foswiki/LoginManager/SmsTwoStepLogin.pm 0775
pub/System/SmsTwoStepAuthContrib/mobile-carrier.gif 0644
pub/System/SmsTwoStepAuthContrib/sms-2step-auth-diagram.png 0644
pub/System/SmsTwoStepAuthContrib/sms-2step-auth-diagram.ppt 0644
pub/System/SmsTwoStepAuthContrib/sms-access-code-login-350.png 0644
pub/System/SmsTwoStepAuthContrib/sms-access-code-login.png 0644
pub/System/SmsTwoStepAuthContrib/sms.gif 0644
templates/smstwostepemaillogin.tmpl 0644
templates/smstwostepemailmessage.tmpl 0644
templates/smstwosteperrorlogin.tmpl 0644
templates/smstwosteplogin.tmpl 0644
templates/smstwostepmessage.tmpl 0644
75 changes: 75 additions & 0 deletions lib/Foswiki/Contrib/SmsTwoStepAuthContrib/build.pl
@@ -0,0 +1,75 @@
#!/usr/bin/perl -w
#
# Example build class. Copy this file to the equivalent place in your
# plugin or contrib and edit.
#
# Read the comments at the top of lib/Foswiki/Contrib/Build.pm for
# details of how the build process works, and what files you
# have to provide and where.
#
# Requires the environment variable FOSWIKI_LIBS (a colon-separated path
# list) to be set to point at the build system and any required dependencies.
# Usage: ./build.pl [-n] [-v] [target]
# where [target] is the optional build target (build, test,
# install, release, uninstall), test is the default.
# Two command-line options are supported:
# -n Don't actually do anything, just print commands
# -v Be verbose
#

# Standard preamble
use strict;
use warnings;

BEGIN { unshift @INC, split( /:/, $ENV{FOSWIKI_LIBS} ); }

use Foswiki::Contrib::Build;

# Create the build object
my $build = new Foswiki::Contrib::Build('SmsTwoStepLoginContrib');

# Build the target on the command line, or the default target
$build->build( $build->{target} );

=begin TML
You can do a lot more with the build system if you want; for example, to add
a new target, you could do this:
<verbatim>
{
package MyModuleBuild;
our @ISA = qw( Foswiki::Contrib::Build );
sub new {
my $class = shift;
return bless( $class->SUPER::new( "MyModule" ), $class );
}
sub target_mytarget {
my $this = shift;
# Do other build stuff here
}
}
# Create the build object
my $build = new MyModuleBuild();
</verbatim>
You can also specify a different default target server for uploads.
This can be any web on any accessible Foswiki installation.
These defaults will be used when expanding tokens in .txt
files, but be warned, they can be overridden at upload time!
<verbatim>
# name of web to upload to
$build->{UPLOADTARGETWEB} = 'Extensions';
# Full URL of pub directory
$build->{UPLOADTARGETPUB} = 'http://foswiki.org/pub';
# Full URL of bin directory
$build->{UPLOADTARGETSCRIPT} = 'http://foswiki.org/bin';
# Script extension
$build->{UPLOADTARGETSUFFIX} = '';
</verbatim>
=cut

0 comments on commit bcf32e8

Please sign in to comment.