Broken app
zykes [Mon, 16 Aug 2010 11:39:11 +0000 (11:39 +0000)]
48 files changed:
Test-Session-Broken/Changes [new file with mode: 0644]
Test-Session-Broken/META.yml [new file with mode: 0644]
Test-Session-Broken/Makefile.PL [new file with mode: 0644]
Test-Session-Broken/README [new file with mode: 0644]
Test-Session-Broken/config.json [new file with mode: 0644]
Test-Session-Broken/lib/Test/LDAP.pm [new file with mode: 0644]
Test-Session-Broken/lib/Test/LDAP/Controller/Auth.pm [new file with mode: 0644]
Test-Session-Broken/lib/Test/LDAP/Controller/Root.pm [new file with mode: 0644]
Test-Session-Broken/lib/Test/LDAP/Controller/User.pm [new file with mode: 0644]
Test-Session-Broken/lib/Test/LDAP/Model/LDAP.pm [new file with mode: 0644]
Test-Session-Broken/lib/Test/LDAP/View/TT.pm [new file with mode: 0644]
Test-Session-Broken/root/auth/index.tt [new file with mode: 0644]
Test-Session-Broken/root/auth/login.tt [new file with mode: 0644]
Test-Session-Broken/root/common/noarg.tt [new file with mode: 0644]
Test-Session-Broken/root/common/noresult.tt [new file with mode: 0644]
Test-Session-Broken/root/common/results.tt [new file with mode: 0644]
Test-Session-Broken/root/default.tt [new file with mode: 0644]
Test-Session-Broken/root/error-404.tt [new file with mode: 0644]
Test-Session-Broken/root/error-500.tt [new file with mode: 0644]
Test-Session-Broken/root/error-generic.tt [new file with mode: 0644]
Test-Session-Broken/root/favicon.ico [new file with mode: 0644]
Test-Session-Broken/root/forms/auth/index.json [new file with mode: 0644]
Test-Session-Broken/root/forms/search/index.json [new file with mode: 0644]
Test-Session-Broken/root/forms/user/edit.json [new file with mode: 0644]
Test-Session-Broken/root/index.tt [new file with mode: 0644]
Test-Session-Broken/root/static/css/style.css [new file with mode: 0644]
Test-Session-Broken/root/static/images/btn_120x50_built.png [new file with mode: 0644]
Test-Session-Broken/root/static/images/btn_120x50_built_shadow.png [new file with mode: 0644]
Test-Session-Broken/root/static/images/btn_120x50_powered.png [new file with mode: 0644]
Test-Session-Broken/root/static/images/btn_120x50_powered_shadow.png [new file with mode: 0644]
Test-Session-Broken/root/static/images/btn_88x31_built.png [new file with mode: 0644]
Test-Session-Broken/root/static/images/btn_88x31_built_shadow.png [new file with mode: 0644]
Test-Session-Broken/root/static/images/btn_88x31_powered.png [new file with mode: 0644]
Test-Session-Broken/root/static/images/btn_88x31_powered_shadow.png [new file with mode: 0644]
Test-Session-Broken/root/static/images/catalyst_logo.png [new file with mode: 0644]
Test-Session-Broken/root/user/edit.tt [new file with mode: 0644]
Test-Session-Broken/script/test_ldap_cgi.pl [new file with mode: 0755]
Test-Session-Broken/script/test_ldap_create.pl [new file with mode: 0755]
Test-Session-Broken/script/test_ldap_fastcgi.pl [new file with mode: 0755]
Test-Session-Broken/script/test_ldap_server.pl [new file with mode: 0755]
Test-Session-Broken/script/test_ldap_test.pl [new file with mode: 0755]
Test-Session-Broken/t/01app.t [new file with mode: 0644]
Test-Session-Broken/t/02pod.t [new file with mode: 0644]
Test-Session-Broken/t/03podcoverage.t [new file with mode: 0644]
Test-Session-Broken/t/controller_Auth.t [new file with mode: 0644]
Test-Session-Broken/t/controller_User.t [new file with mode: 0644]
Test-Session-Broken/t/ldap_client.t [new file with mode: 0644]
Test-Session-Broken/t/view_TT.t [new file with mode: 0644]

diff --git a/Test-Session-Broken/Changes b/Test-Session-Broken/Changes
new file mode 100644 (file)
index 0000000..991849b
--- /dev/null
@@ -0,0 +1,4 @@
+This file documents the revision history for Perl extension Test::LDAP.
+
+0.01  2010-08-03 15:00:19
+        - initial revision, generated by Catalyst
diff --git a/Test-Session-Broken/META.yml b/Test-Session-Broken/META.yml
new file mode 100644 (file)
index 0000000..904fb47
--- /dev/null
@@ -0,0 +1,39 @@
+---
+abstract: 'Catalyst based application'
+author:
+  - root
+build_requires:
+  ExtUtils::MakeMaker: 6.42
+  Test::More: 0.88
+configure_requires:
+  ExtUtils::MakeMaker: 6.42
+distribution_type: module
+generated_by: 'Module::Install version 1.00'
+license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: Test-LDAP
+no_index:
+  directory:
+    - inc
+    - t
+requires:
+  Catalyst::Action::RenderView: 0
+  Catalyst::Authentication::Store::LDAP: 0
+  Catalyst::Controller::HTML::FormFu: 0
+  Catalyst::Model::Adaptor: 0
+  Catalyst::Plugin::Authentication: 0
+  Catalyst::Plugin::Authorization::Roles: 0
+  Catalyst::Plugin::ConfigLoader: 0
+  Catalyst::Plugin::Session: 0
+  Catalyst::Plugin::Session::State::Cookie: 0
+  Catalyst::Plugin::Session::Store::FastMmap: 0
+  Catalyst::Plugin::Static::Simple: 0
+  Catalyst::Runtime: 5.80024
+  Config::JSON: 0
+  Moose: 0
+  namespace::autoclean: 0
+resources:
+  license: http://dev.perl.org/licenses/
+version: 0.01
diff --git a/Test-Session-Broken/Makefile.PL b/Test-Session-Broken/Makefile.PL
new file mode 100644 (file)
index 0000000..6135f74
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/env perl
+# IMPORTANT: if you delete this file your app will not work as
+# expected.  You have been warned.
+use inc::Module::Install;
+use Module::Install::Catalyst; # Complain loudly if you don't have
+                               # Catalyst::Devel installed or haven't said
+                               # 'make dist' to create a standalone tarball.
+
+name 'Test-LDAP';
+all_from 'lib/Test/LDAP.pm';
+
+requires 'Catalyst::Runtime' => '5.80024';
+
+requires 'Catalyst::Plugin::Authentication';
+requires 'Catalyst::Plugin::Authorization::Roles'; 
+requires 'Catalyst::Authentication::Store::LDAP';
+
+requires 'Catalyst::Plugin::Session';
+requires 'Catalyst::Plugin::Session::State::Cookie';
+requires 'Catalyst::Plugin::Session::Store::FastMmap';
+
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Action::RenderView';
+
+requires 'Catalyst::Model::Adaptor';
+requires 'Catalyst::Controller::HTML::FormFu';
+
+requires 'Moose';
+requires 'namespace::autoclean';
+requires 'Config::JSON'; # This should reflect the config file format you've chosen
+                 # See Catalyst::Plugin::ConfigLoader for supported formats
+test_requires 'Test::More' => '0.88';
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;
diff --git a/Test-Session-Broken/README b/Test-Session-Broken/README
new file mode 100644 (file)
index 0000000..483a386
--- /dev/null
@@ -0,0 +1 @@
+Run script/test_ldap_server.pl to test the application.
diff --git a/Test-Session-Broken/config.json b/Test-Session-Broken/config.json
new file mode 100644 (file)
index 0000000..3a6bede
--- /dev/null
@@ -0,0 +1,46 @@
+{
+    "name" : "Test::LDAP",
+
+
+    "authentication" : {
+        "default_realm" : "ldap",
+
+        "realms" : {
+            "ldap" : {
+                "credential" : {
+                    "class" : "Password",
+                    "password_field" : "password",
+                    "password_type" : "self_check",
+                    "password_hash_type" : "crypt"
+                },
+
+                "store" : {
+                    "binddn"                : "anonymous",
+                    "bindpw"                : "dontcare",
+
+                    "class"                 : "LDAP",
+
+                    "ldap_server"           : "ldap.test.no",
+                    "ldap_server_options"   : { "timeout" : 30, "port" : "636", "scheme" : "ldaps" },
+
+
+                    "role_basedn"           : "ou=stavanger,o=test,c=no",
+                    "role_field"            : "cn",
+                    "role_filter"           : "(&(objectClass=groupOfNames)(member=%s))",
+                    "role_scope"            : "one",
+                    "role_search_options"   : { "deref" : "always" },
+                    "role_value"            : "dn",
+                    "role_search_as_user"   : "1",
+                    
+                    "user_basedn"           : "ou=stavanger,o=test,c=no",
+                    "user_field"            : "uid",
+                    "user_filter"            : "(&(objectClass=posixAccount)(uid=%s))",
+                    "user_scope"              : "one",
+                    "user_search_options"   : { "deref" : "always" }
+                }
+            }
+        }
+    },
+
+    "Controller::HTML::FormFu" : { "config_file_ext" : ".json" }
+}
diff --git a/Test-Session-Broken/lib/Test/LDAP.pm b/Test-Session-Broken/lib/Test/LDAP.pm
new file mode 100644 (file)
index 0000000..8bbda31
--- /dev/null
@@ -0,0 +1,79 @@
+package Test::LDAP;
+use Moose;
+use namespace::autoclean;
+
+use Catalyst::Runtime 5.80;
+
+# Set flags and add plugins for the application
+#
+#         -Debug: activates the debug mode for very useful log messages
+#   ConfigLoader: will load the configuration from a Config::General file in the
+#                 application's home directory
+# Static::Simple: will serve static files from the application's root
+#                 directory
+
+use Catalyst qw/
+    -Debug
+    ConfigLoader
+    Static::Simple
+    
+    Authentication
+    Authorization::Roles
+    Session
+    Session::State::Cookie
+    Session::Store::FastMmap
+/;
+
+extends 'Catalyst';
+
+our $VERSION = '0.01';
+$VERSION = eval $VERSION;
+
+# Configure the application.
+#
+# Note that settings in test_ldap_web.conf (or other external
+# configuration file that you set up manually) take precedence
+# over this when using ConfigLoader. Thus configuration
+# details given here can function as a default configuration,
+# with an external configuration file acting as an override for
+# local deployment.
+
+__PACKAGE__->config(
+    # Disable deprecated behavior needed by old applications
+    disable_component_resolution_regex_fallback => 1,
+
+    'Plugin::ConfigLoader' => { file => 'config.json' },
+);
+
+# Start the application
+__PACKAGE__->setup();
+
+
+=head1 NAME
+
+Test::LDAP - Catalyst based application
+
+=head1 SYNOPSIS
+
+    script/test_ldap_web_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<Test::LDAP::Controller::Root>, L<Catalyst>
+
+=head1 AUTHOR
+
+root
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
diff --git a/Test-Session-Broken/lib/Test/LDAP/Controller/Auth.pm b/Test-Session-Broken/lib/Test/LDAP/Controller/Auth.pm
new file mode 100644 (file)
index 0000000..64c3c59
--- /dev/null
@@ -0,0 +1,86 @@
+package Test::LDAP::Controller::Auth;
+use Moose;
+use namespace::autoclean;
+
+BEGIN {extends 'Catalyst::Controller::HTML::FormFu'; }
+
+=head1 NAME
+
+Test::LDAP::Controller::Auth - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+sub index :Path :Args(0) :FormConfig {
+    my ( $self, $c ) = @_;
+
+    my $form = $c->stash->{form};
+}
+
+sub login :Path("login") :Args(0) {
+    my ( $self, $c ) = @_;
+
+    my $user = $c->req->params->{'username'};
+    my $pass = $c->req->params->{'password'};
+
+
+    if ($c->user_exists) {
+        $c->response->redirect( $c->uri_for( $c->controller("Auth")->action_for("index") ) )
+    }
+
+    # Got username / pass?
+    if ( defined ($user) && defined ($pass) ) {
+        # Let's auth
+        my $auth = $c->authenticate (
+            { username => $user, password => $pass }, "ldap"
+        );
+
+        # Let's check if we are authed, if we are then we forward to the index.
+        # Else we'll throw an error into message and display the login page
+        if ($auth) {
+            $c->response->redirect( $c->uri_for( $c->controller("Root")->action_for("index") ) );;
+
+            # Since we got auth, let's bind with the model with a dn & pass as well.
+            #$c->model('LDAP')->bind (dn => $
+        } else {
+            $c->stash->{"message"} = ("Bad username and/or password");
+        }
+
+    } else {
+        # If not throw a message c
+        $c->stash->{"message"} = "Missing Username and/or password"
+    }
+}
+
+sub logout : Path("logout") {
+    my ( $self, $c ) = @_;
+
+    if ($c->user_exists) {
+        $c->logout;
+    }
+    $c->response->redirect( $c->uri_for( $c->controller("Root")->action_for("index") ) )
+}
+
+=head1 AUTHOR
+
+root
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/Test-Session-Broken/lib/Test/LDAP/Controller/Root.pm b/Test-Session-Broken/lib/Test/LDAP/Controller/Root.pm
new file mode 100644 (file)
index 0000000..0d85a6b
--- /dev/null
@@ -0,0 +1,78 @@
+package Test::LDAP::Controller::Root;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller' }
+
+#
+# Sets the actions in this controller to be registered with no prefix
+# so they function identically to actions created in MyApp.pm
+#
+__PACKAGE__->config(namespace => '');
+
+=head1 NAME
+
+Test::LDAP::Controller::Root - Root Controller for Test::LDAP
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=head2 itndex
+
+The root page (/)
+
+=cut
+
+sub index :Path :Args(0) {
+    my ( $self, $c ) = @_;
+}
+
+=head2 default
+
+Standard 404 error page
+
+=cut
+
+sub default :Path {
+    my ( $self, $c ) = @_;
+
+    $c->stash->{"template"} = "error-404.tt";
+    $c->res->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {
+    my ($self, $c) = @_;
+    my $errors = scalar @{$c->error};
+
+    if ($errors && not defined $c->stash->{"error_msg"}) {
+        $c->stash->{"template"} = "error-500.tt";
+
+        $c->stash->{"message"} = join "\n", @{$c->error};
+        $c->res->status(500);
+        $c->clear_errors;
+    }
+}
+
+=head1 AUTHOR
+
+root
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/Test-Session-Broken/lib/Test/LDAP/Controller/User.pm b/Test-Session-Broken/lib/Test/LDAP/Controller/User.pm
new file mode 100644 (file)
index 0000000..88b3400
--- /dev/null
@@ -0,0 +1,158 @@
+package Test::LDAP::Controller::User;
+use Moose;
+use namespace::autoclean;
+
+BEGIN {extends 'Catalyst::Controller::HTML::FormFu'; }
+
+=head1 NAME
+
+Test::LDAP::Controller::User - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub base :Chained('/') :PathPart('user') :CaptureArgs(0) {
+    my ($self, $c) = @_;
+}
+
+sub user :Chained('base') :PathPart('') :CaptureArgs(2) {
+    my $self = shift;
+    my $c    = shift;
+
+    # Do we have an id?
+    my $noargs = undef;
+    if ($#_ != -1) {
+        foreach (@_) {
+            if ($_ =~ /^$/) { $noargs = 1 }
+        }
+    }
+
+    if ($noargs) {
+        $c->stash->{template} = "common/noarg.tt";
+        $c->detach;
+    }
+
+    my ($id, $ou) = @_;
+
+    # Store div stuff for use in templates.
+    $c->stash( 
+        id => $id, 
+        ou => $ou, 
+        type => "User",
+        resultset => { $id => $c->model('LDAP')->user("etk") }
+    );
+
+    my $noresult = undef;
+    # Do we have any entries?
+    if ( $ou !~ /^\*$/ ) {
+        if (not defined $c->stash->{resultset}->{$id}->{$ou}) {
+            $noresult = 1;
+        } else {
+            $c->stash->{result}->{$id}->{$ou} = $c->stash->{resultset}->{$id}->{$ou}
+        }
+    } else {
+        if ($c->model('LDAP')->mesg->count == 0) {
+            $noresult = 1;
+        } else {
+            $c->stash->{result} = $c->stash->{resultset};
+        }
+    }
+
+    if ($noresult) {
+        $c->stash->{template} = "common/noresult.tt";
+        $c->detach;
+    }
+}
+
+sub view :Chained('user') :PathPart('view') :Args(0) {
+    my ($self, $c) = @_;
+
+    $c->stash->{template} = "common/results.tt"
+}
+
+sub edit :Chained('user') :PathPart('edit') :Args(0) :FormConfig {
+    my ( $self, $c ) = @_;
+
+    # Check if the loc that is specified is a wildcard, do an error if it's true
+    if ($c->stash->{ou} =~ /^\*/) {
+        $c->stash(
+            template => "error-generic.tt",
+            message => "You cannot use '*' as an OU / Location when editing a user!",
+        );
+        $c->res->status("500");
+        $c->detach
+    }
+
+    # Get the form.
+    my $form = $c->stash->{"form"};
+
+    # Get the ldap object from the loaded objects
+    my $entry = $c->stash->{result}->{ $c->stash->{id} }->{ $c->stash->{ou} };
+
+    #  If the form is submitted and valid let's try to update the data
+    if ($form->submitted_and_valid) {
+        my $params = $c->req->params;
+
+        foreach my $attr ($params) {
+            $entry->replace ($attr => $params->{$attr}) if ( defined ($params->{$attr}) );
+        }
+
+        $entry->update
+    }
+
+    # Autofill the form..
+    my $options = {};
+    foreach my $attr ($entry->attributes) {
+        my $value = $entry->get_value($attr);
+        $options->{$attr} = $value;
+
+        push @{$c->stash->{attributes}}, $attr . ":" . $value . "<br />"
+    }
+
+    $form->default_values($options);
+}
+
+=head2 auto
+
+Check if the user is authenicated, if not we just forward to the login page.
+
+=cut
+sub auto :Private {
+    my ( $self, $c ) = @_;
+
+    if (!$c->user_exists) {
+        $c->log->debug('*** $c->controller::auto User not found, forwarding to auth');
+
+        $c->response->redirect( $c->uri_for( $c->controller("Auth")->action_for("index") ) );
+
+        return 0
+    }
+
+    return 1
+}
+
+
+=head1 AUTHOR
+
+root
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/Test-Session-Broken/lib/Test/LDAP/Model/LDAP.pm b/Test-Session-Broken/lib/Test/LDAP/Model/LDAP.pm
new file mode 100644 (file)
index 0000000..25a7544
--- /dev/null
@@ -0,0 +1,5 @@
+package Test::LDAP::Model::LDAP;
+
+use Moose;
+use namespace::autoclean;
+extends 'Catalyst::Model::LDAP::FromAuthentication';
diff --git a/Test-Session-Broken/lib/Test/LDAP/View/TT.pm b/Test-Session-Broken/lib/Test/LDAP/View/TT.pm
new file mode 100644 (file)
index 0000000..db6ab41
--- /dev/null
@@ -0,0 +1,37 @@
+package Test::LDAP::View::TT;
+
+use strict;
+use warnings;
+
+use base 'Catalyst::View::TT';
+
+__PACKAGE__->config(
+    TEMPLATE_EXTENSION => '.tt',
+    render_die => 1,
+    WRAPPER => "default.tt"
+);
+
+=head1 NAME
+
+Test::LDAP::View::TT - TT View for Test::LDAP
+
+=head1 DESCRIPTION
+
+TT View for Test::LDAP.
+
+=head1 SEE ALSO
+
+L<Test::LDAP>
+
+=head1 AUTHOR
+
+root
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
diff --git a/Test-Session-Broken/root/auth/index.tt b/Test-Session-Broken/root/auth/index.tt
new file mode 100644 (file)
index 0000000..fd94ed8
--- /dev/null
@@ -0,0 +1,9 @@
+[% IF ! c.user_exists %]
+
+[% form %]
+
+[% ELSE %]
+
+<p>You are already logged in.</p>
+
+[% END %]
diff --git a/Test-Session-Broken/root/auth/login.tt b/Test-Session-Broken/root/auth/login.tt
new file mode 100644 (file)
index 0000000..a18405c
--- /dev/null
@@ -0,0 +1 @@
+Login failure
diff --git a/Test-Session-Broken/root/common/noarg.tt b/Test-Session-Broken/root/common/noarg.tt
new file mode 100644 (file)
index 0000000..f152daf
--- /dev/null
@@ -0,0 +1 @@
+<h2>Missing ID or too short</h2>
diff --git a/Test-Session-Broken/root/common/noresult.tt b/Test-Session-Broken/root/common/noresult.tt
new file mode 100644 (file)
index 0000000..8b43476
--- /dev/null
@@ -0,0 +1 @@
+<h2>[% type %] "[% id %]" was not found in location "[% ou %]"</h2>
diff --git a/Test-Session-Broken/root/common/results.tt b/Test-Session-Broken/root/common/results.tt
new file mode 100644 (file)
index 0000000..4124465
--- /dev/null
@@ -0,0 +1,21 @@
+<h3>Results</h3>
+
+[% FOREACH var IN result.keys.sort %] 
+    <!-- div pr user for example -->
+    <div class="result var">
+    <strong>Name: [% var %]</strong><br/>
+
+    <!-- div pr ou for example -->
+    [% FOREACH subvar IN result.$var.keys.sort %]
+        <div class="result subvar">
+        <strong>Location: [% subvar FILTER ucfirst %]</strong><br />
+
+        [% FOREACH attr IN result.$var.$subvar.attributes.sort %]
+            [% value = result.$var.$subvar.get_value(attr).join(", ") %]
+            <span class="result subvark">[% attr %]:</span> [% value %]<br />
+        [% END %]
+        </div>
+    [% END %]
+
+    </div>
+[% END %]
diff --git a/Test-Session-Broken/root/default.tt b/Test-Session-Broken/root/default.tt
new file mode 100644 (file)
index 0000000..3fd39dd
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+    <title>Test LDAP - BETA</title>
+    <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
+</head>
+
+<body id="body">
+<div id="container">
+
+<div id="header">
+<h1>Test LDAP - BETA</h1>
+<img id='powered' src="/static/images/btn_88x31_built.png"/>
+<div id="navbar">
+    <a href="[% c.uri_for('/') %]">Home</a>
+    [% IF c.user_exists %]
+    <a href="[% c.uri_for('/search') %]">Search</a>
+    <a href="[% c.uri_for('/auth/logout') %]">Logout</a>
+    [% ELSE %]
+    <a href="[% c.uri_for('/auth') %]">Login</a>
+    [% END %]
+</div>
+</div>
+
+<div id="content">
+[% IF message %]
+<div class="messageblock">[% message %]</div>
+[% END %]
+[% content %]
+</div>
+
+</div>
+</body>
diff --git a/Test-Session-Broken/root/error-404.tt b/Test-Session-Broken/root/error-404.tt
new file mode 100644 (file)
index 0000000..83d59a2
--- /dev/null
@@ -0,0 +1 @@
+<p> Error, page you requested was not found.</p>
diff --git a/Test-Session-Broken/root/error-500.tt b/Test-Session-Broken/root/error-500.tt
new file mode 100644 (file)
index 0000000..a2c88b7
--- /dev/null
@@ -0,0 +1,3 @@
+<p> 
+Error, server encountered an internal error. See above for error message.
+</p>
diff --git a/Test-Session-Broken/root/error-generic.tt b/Test-Session-Broken/root/error-generic.tt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Test-Session-Broken/root/favicon.ico b/Test-Session-Broken/root/favicon.ico
new file mode 100644 (file)
index 0000000..5ad723d
Binary files /dev/null and b/Test-Session-Broken/root/favicon.ico differ
diff --git a/Test-Session-Broken/root/forms/auth/index.json b/Test-Session-Broken/root/forms/auth/index.json
new file mode 100644 (file)
index 0000000..2db610f
--- /dev/null
@@ -0,0 +1,22 @@
+{
+    "action" : "/auth/login",
+    "elements" : [
+        {
+            "name"          : "username",
+            "type"          : "Text",
+            "label"         : "Username",
+            "constraints"   : "Required"
+        },
+        {
+            "name"          : "password",
+            "type"          : "Password",
+            "label"         : "Password",
+            "constraints"   : "Required"
+        },
+        {
+            "name"  : "submit",
+            "type"  : "Submit",
+            "value" : "Login"
+        }
+    ]
+}
diff --git a/Test-Session-Broken/root/forms/search/index.json b/Test-Session-Broken/root/forms/search/index.json
new file mode 100644 (file)
index 0000000..a08be97
--- /dev/null
@@ -0,0 +1,72 @@
+{
+    "action" : "/search/results",
+
+    "indicator" : "Submit",
+
+    "elements" : [
+        {
+            "name"  : "search",
+            "type"  : "Text",
+            "label" : "Search",
+            "constraints" : "Required",
+
+            "auto_label" : "text search label",
+
+            "attributes" : {
+                "title" : "Enter something to search for"
+            }
+        }, 
+
+        {
+            "name"  : "submit",
+            "type"  : "Submit",
+            "value" : "Submit",
+
+            "attributes" : {
+                "title" : "Submit"
+            }
+        },
+        {
+            // OU's are gotten automagically from the LDAP Server
+            // All of them are automatically selected.
+            "name"  : "ous",
+            "type"  : "Select",
+            "label" : "Location",
+            "multiple" : 1,
+            "size"  : 10
+        },
+
+        {
+            "name" : "type",
+            "type" : "Radiogroup",
+            "options" : [
+                // Search up users
+                { 
+                    "value" : "id", 
+                    "label" : "ID", 
+                    "attributes" : { "checked" : "checked"} 
+                },
+
+                // Common name
+                [ "cn", "Common Name" ],
+
+                // UID nr
+                [ "uid", "UID Number" ],
+                
+                // Groups
+                [ "groups", "List All groups" ],
+                
+                // Users
+                [ "users", "List All users" ],
+                
+                // Groups for id
+                [ "id_groups", "Groups for ID" ],
+                
+                // Groups
+                [ "group", "Groups" ]
+            ]
+        }
+
+   ]
+}
diff --git a/Test-Session-Broken/root/forms/user/edit.json b/Test-Session-Broken/root/forms/user/edit.json
new file mode 100644 (file)
index 0000000..0e019f0
--- /dev/null
@@ -0,0 +1,41 @@
+{
+    "indicator" : "submit",
+
+    "elements" : [
+        {
+            "name" : "cn",
+            "type" : "Text",
+            "label" : "Common Name",
+            "constraints" : "Required"
+        },
+        /* disabled for now{
+            "name" : "description",
+            "type" : "Text",
+            "label" : "Description"
+            //"constraints" : "Required"
+        },*/
+        {
+            "name" : "gecos",
+            "type" : "Text",
+            "label" : "Gecos",
+            "constraints" : "Required"
+        },
+        {
+            "name" : "gidNumber",
+            "type" : "Text",
+            "label" : "Group Id Number",
+            "constraints" : [ "Required", "Integer" ]
+        },
+        {
+            "name" : "loginShell",
+            "type" : "Text",
+            "label" : "Login Shell",
+            "constraints" : "Required"
+        },
+        {
+            "name" : "submit",
+            "type" : "Submit",
+            "value" : "Submit"
+        }
+    ]
+}
diff --git a/Test-Session-Broken/root/index.tt b/Test-Session-Broken/root/index.tt
new file mode 100644 (file)
index 0000000..021b141
--- /dev/null
@@ -0,0 +1,7 @@
+<p>Add links here later / documentation?</p>
+
+[% IF ! c.user_exists %]
+Please login
+[% ELSE %]
+
+[% END %]
diff --git a/Test-Session-Broken/root/static/css/style.css b/Test-Session-Broken/root/static/css/style.css
new file mode 100644 (file)
index 0000000..339da70
--- /dev/null
@@ -0,0 +1,100 @@
+body {
+    margin: 0px;
+    padding: 0px;
+    font-family: arial;
+}
+
+#container{
+       width: 990px;
+       margin-left: auto;
+       margin-right: auto;
+       margin-top: 20px;
+       background: #fff;
+       position:relative;
+       overflow:hidden;
+}
+
+#header {
+    background-color: #990000;
+    color: #ffffff;
+    margin: 0px;
+    padding: 1px;
+    border-bottom: 3px solid red;
+    height: 100px;
+    width: 100%;
+}
+#header h1 {
+    padding: 5px;
+}
+
+
+#navbar {
+    position: absolute;
+    background-color: #660000;
+    border-top: 1px solid white;
+    top: 74px;
+    height: 24px;
+    width: 100%;
+}
+#navbar a {
+    color: white;
+    padding-left: 10px;
+    padding-right: 10px;
+    text-decoration: none;
+    font-weight: bold;
+    font-size: 16px;
+}
+#navbar a:hover {
+    background-color: #330000;
+}
+
+
+#powered {
+    position: absolute;
+    top: 20px;
+    left: 600px;
+}
+#content {
+    background-color: #dddddd;
+    color: black;
+    padding: 5px;
+    padding-top: 20px;
+}
+
+.messageblock {
+    background-color: #dddddd;
+    margin: 20px;
+    padding: 10px;
+    border: 1px solid #009900;
+    width: 500px;
+    font-size: 1.2em;
+}
+
+.form {
+    margin:0 auto;
+    width:400px;
+    padding:14px;
+}
+
+
+
+.result.var {
+    width: 99%;
+    padding: 1px;
+    border:1px dashed #660000;;
+}
+
+.result.subvar {
+    width:98%;
+    border:1px dotted white;
+    padding:5px;
+    margin-bottom:5px;
+}
+
+.result.subvark{
+    font-style: italic;
+    font-weight: bold;
+}
+
+.result.subvarv {
+}
diff --git a/Test-Session-Broken/root/static/images/btn_120x50_built.png b/Test-Session-Broken/root/static/images/btn_120x50_built.png
new file mode 100644 (file)
index 0000000..c709fd6
Binary files /dev/null and b/Test-Session-Broken/root/static/images/btn_120x50_built.png differ
diff --git a/Test-Session-Broken/root/static/images/btn_120x50_built_shadow.png b/Test-Session-Broken/root/static/images/btn_120x50_built_shadow.png
new file mode 100644 (file)
index 0000000..15142fe
Binary files /dev/null and b/Test-Session-Broken/root/static/images/btn_120x50_built_shadow.png differ
diff --git a/Test-Session-Broken/root/static/images/btn_120x50_powered.png b/Test-Session-Broken/root/static/images/btn_120x50_powered.png
new file mode 100644 (file)
index 0000000..7249b47
Binary files /dev/null and b/Test-Session-Broken/root/static/images/btn_120x50_powered.png differ
diff --git a/Test-Session-Broken/root/static/images/btn_120x50_powered_shadow.png b/Test-Session-Broken/root/static/images/btn_120x50_powered_shadow.png
new file mode 100644 (file)
index 0000000..e6876c0
Binary files /dev/null and b/Test-Session-Broken/root/static/images/btn_120x50_powered_shadow.png differ
diff --git a/Test-Session-Broken/root/static/images/btn_88x31_built.png b/Test-Session-Broken/root/static/images/btn_88x31_built.png
new file mode 100644 (file)
index 0000000..007b5db
Binary files /dev/null and b/Test-Session-Broken/root/static/images/btn_88x31_built.png differ
diff --git a/Test-Session-Broken/root/static/images/btn_88x31_built_shadow.png b/Test-Session-Broken/root/static/images/btn_88x31_built_shadow.png
new file mode 100644 (file)
index 0000000..ccf4624
Binary files /dev/null and b/Test-Session-Broken/root/static/images/btn_88x31_built_shadow.png differ
diff --git a/Test-Session-Broken/root/static/images/btn_88x31_powered.png b/Test-Session-Broken/root/static/images/btn_88x31_powered.png
new file mode 100644 (file)
index 0000000..8f0cd9f
Binary files /dev/null and b/Test-Session-Broken/root/static/images/btn_88x31_powered.png differ
diff --git a/Test-Session-Broken/root/static/images/btn_88x31_powered_shadow.png b/Test-Session-Broken/root/static/images/btn_88x31_powered_shadow.png
new file mode 100644 (file)
index 0000000..aa776fa
Binary files /dev/null and b/Test-Session-Broken/root/static/images/btn_88x31_powered_shadow.png differ
diff --git a/Test-Session-Broken/root/static/images/catalyst_logo.png b/Test-Session-Broken/root/static/images/catalyst_logo.png
new file mode 100644 (file)
index 0000000..21f1cac
Binary files /dev/null and b/Test-Session-Broken/root/static/images/catalyst_logo.png differ
diff --git a/Test-Session-Broken/root/user/edit.tt b/Test-Session-Broken/root/user/edit.tt
new file mode 100644 (file)
index 0000000..9c0b95d
--- /dev/null
@@ -0,0 +1,3 @@
+<h3>Editing user "[% id %]" in location "[% ou FILTER ucfirst %]"</h3>
+[% test %]
+[% form %]
diff --git a/Test-Session-Broken/script/test_ldap_cgi.pl b/Test-Session-Broken/script/test_ldap_cgi.pl
new file mode 100755 (executable)
index 0000000..d03114e
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test::LDAP', 'CGI');
+
+1;
+
+=head1 NAME
+
+test_ldap_cgi.pl - Catalyst CGI
+
+=head1 SYNOPSIS
+
+See L<Catalyst::Manual>
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as a cgi script.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
diff --git a/Test-Session-Broken/script/test_ldap_create.pl b/Test-Session-Broken/script/test_ldap_create.pl
new file mode 100755 (executable)
index 0000000..98c3a18
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test::LDAP', 'Create');
+
+1;
+
+=head1 NAME
+
+test_ldap_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+test_ldap_create.pl [options] model|view|controller name [helper] [options]
+
+ Options:
+   --force        don't create a .new file where a file to be created exists
+   --mechanize    use Test::WWW::Mechanize::Catalyst for tests if available
+   --help         display this help and exits
+
+ Examples:
+   test_ldap_create.pl controller My::Controller
+   test_ldap_create.pl -mechanize controller My::Controller
+   test_ldap_create.pl view My::View
+   test_ldap_create.pl view HTML TT
+   test_ldap_create.pl model My::Model
+   test_ldap_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+   dbi:SQLite:/tmp/my.db
+   test_ldap_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
+   [Loader opts like db_schema, naming] dbi:Pg:dbname=foo root 4321
+   [connect_info opts like quote_char, name_sep]
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+   perldoc Catalyst::Helper::Model::DBIC::Schema
+   perldoc Catalyst::Model::DBIC::Schema
+   perldoc Catalyst::View::TT
+
+=head1 DESCRIPTION
+
+Create a new Catalyst Component.
+
+Existing component files are not overwritten.  If any of the component files
+to be created already exist the file will be written with a '.new' suffix.
+This behavior can be suppressed with the C<-force> option.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
diff --git a/Test-Session-Broken/script/test_ldap_fastcgi.pl b/Test-Session-Broken/script/test_ldap_fastcgi.pl
new file mode 100755 (executable)
index 0000000..f873636
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test::LDAP', 'FastCGI');
+
+1;
+
+=head1 NAME
+
+test_ldap_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+test_ldap_fastcgi.pl [options]
+
+ Options:
+   -? -help      display this help and exits
+   -l --listen   Socket path to listen on
+                 (defaults to standard input)
+                 can be HOST:PORT, :PORT or a
+                 filesystem path
+   -n --nproc    specify number of processes to keep
+                 to serve requests (defaults to 1,
+                 requires -listen)
+   -p --pidfile  specify filename for pid file
+                 (requires -listen)
+   -d --daemon   daemonize (requires -listen)
+   -M --manager  specify alternate process manager
+                 (FCGI::ProcManager sub-class)
+                 or empty string to disable
+   -e --keeperr  send error messages to STDOUT, not
+                 to the webserver
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as fastcgi.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
diff --git a/Test-Session-Broken/script/test_ldap_server.pl b/Test-Session-Broken/script/test_ldap_server.pl
new file mode 100755 (executable)
index 0000000..9b9355e
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env perl
+
+BEGIN {
+    $ENV{CATALYST_SCRIPT_GEN} = 40;
+}
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test::LDAP', 'Server');
+
+1;
+
+=head1 NAME
+
+test_ldap_server.pl - Catalyst Test Server
+
+=head1 SYNOPSIS
+
+test_ldap_server.pl [options]
+
+   -d --debug           force debug mode
+   -f --fork            handle each request in a new process
+                        (defaults to false)
+   -? --help            display this help and exits
+   -h --host            host (defaults to all)
+   -p --port            port (defaults to 3000)
+   -k --keepalive       enable keep-alive connections
+   -r --restart         restart when files get modified
+                        (defaults to false)
+   -rd --restart_delay  delay between file checks
+                        (ignored if you have Linux::Inotify2 installed)
+   -rr --restart_regex  regex match files that trigger
+                        a restart when modified
+                        (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
+   --restart_directory  the directory to search for
+                        modified files, can be set mulitple times
+                        (defaults to '[SCRIPT_DIR]/..')
+   --follow_symlinks    follow symlinks in search directories
+                        (defaults to false. this is a no-op on Win32)
+   --background         run the process in the background
+   --pidfile            specify filename for pid file
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
diff --git a/Test-Session-Broken/script/test_ldap_test.pl b/Test-Session-Broken/script/test_ldap_test.pl
new file mode 100755 (executable)
index 0000000..f7633bb
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test::LDAP', 'Test');
+
+1;
+
+=head1 NAME
+
+test_ldap_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+test_ldap_test.pl [options] uri
+
+ Options:
+   --help    display this help and exits
+
+ Examples:
+   test_ldap_test.pl http://localhost/some_action
+   test_ldap_test.pl /some_action
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
diff --git a/Test-Session-Broken/t/01app.t b/Test-Session-Broken/t/01app.t
new file mode 100644 (file)
index 0000000..6aa3717
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN { use_ok 'Catalyst::Test', 'Test::LDAP' }
+
+ok( request('/')->is_success, 'Request should succeed' );
+
+done_testing();
diff --git a/Test-Session-Broken/t/02pod.t b/Test-Session-Broken/t/02pod.t
new file mode 100644 (file)
index 0000000..ababc2e
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+
+all_pod_files_ok();
diff --git a/Test-Session-Broken/t/03podcoverage.t b/Test-Session-Broken/t/03podcoverage.t
new file mode 100644 (file)
index 0000000..6ddc5c6
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+
+eval "use Pod::Coverage 0.20";
+plan skip_all => 'Pod::Coverage 0.20 required' if $@;
+
+all_pod_coverage_ok();
diff --git a/Test-Session-Broken/t/controller_Auth.t b/Test-Session-Broken/t/controller_Auth.t
new file mode 100644 (file)
index 0000000..be38b2b
--- /dev/null
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN { use_ok 'Catalyst::Test', 'Test::LDAP' }
+BEGIN { use_ok 'Test::LDAP::Controller::Auth' }
+
+ok( request('/auth')->is_success, 'Request should succeed' );
+done_testing();
diff --git a/Test-Session-Broken/t/controller_User.t b/Test-Session-Broken/t/controller_User.t
new file mode 100644 (file)
index 0000000..1edcd61
--- /dev/null
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN { use_ok 'Catalyst::Test', 'Test::LDAP' }
+BEGIN { use_ok 'Test::LDAP::Controller::User' }
+
+ok( request('/user')->is_success, 'Request should succeed' );
+done_testing();
diff --git a/Test-Session-Broken/t/ldap_client.t b/Test-Session-Broken/t/ldap_client.t
new file mode 100644 (file)
index 0000000..fa5afcb
--- /dev/null
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use Test::More qw(no_plan);
+use Test::LDAP::Client;
+
+my $server = "ldap.test.no";
+
+ok(
+    my $slc = Test::LDAP::Client->new( "host" => $server ),
+    'Created new ok towards ' . $server
+);
+
+ok(
+    $slc->ous,
+    "Getting Ous ok"
+);
diff --git a/Test-Session-Broken/t/view_TT.t b/Test-Session-Broken/t/view_TT.t
new file mode 100644 (file)
index 0000000..e1a43b3
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN { use_ok 'Test::LDAP::View::TT' }
+
+done_testing();