index_simple.pl 5.62 KB
Newer Older
1
2
3
4
5
6
#!/usr/bin/perl

use Lemonldap::NG::Portal::SharedConf;

my $portal = Lemonldap::NG::Portal::SharedConf->new(
    {
7
8

        # ACCESS TO CONFIGURATION
9
        # By default, Lemonldap::NG uses the default lemonldap-ng.ini file to know
Yadd's avatar
Yadd committed
10
        # where to find its configuration
11
        # (generaly /etc/lemonldap-ng/lemonldap-ng.ini)
12
        # You can specify by yourself this file :
13
        #configStorage => { confFile => '/path/to/my/file' },
Yadd's avatar
Yadd committed
14
15
        # or set explicitely parameters :
        #configStorage => {
16
17
        #  type => 'File',
        #  dirName => '/usr/local/lemonldap-ng/data/conf/'
Yadd's avatar
Yadd committed
18
19
20
        #},
        # Note that YOU HAVE TO SET configStorage here if you've declared this
        # portal as SOAP configuration server in the manager
21

22
23
24
25
26
        # LOG
        # By default, all is logged in Apache file. To log user actions by
        # syslog, just set syslog facility here:
        #syslog => 'auth',

27
28
29
        # SOAP FUNCTIONS
        # Remove comment to activate SOAP Functions getCookies(user,pwd) and
        # error(language, code)
Yadd's avatar
Yadd committed
30
31
32
33
34
        Soap => 1,
        # Note that getAttibutes() will be activated but on a different URI
        # (http://auth.example.com/index.pl/sessions)
        # You can also restrict attributes and macros exported by getAttributes
        #exportedAttr => 'uid mail',
35
36
37
38
39
40
41
42

        # PASSWORD POLICY
        # Remove comment to use LDAP Password Policy
        #ldapPpolicyControl => 1,

        # Remove comment to store password in session (use with caution)
        #storePassword      => 1,

Yadd's avatar
Yadd committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
        # Remove comment to use LDAP modify password extension
        # (beware of compatibility with LDAP Password Policy)
        #ldapSetPassword    => 1,

        # RESET PASSWORD BY MAIL
        # SMTP server (default to localhost), set to '' to use default mail
        # service
        #SMTPServer => "localhost",

        # Mail From address
        #mailFrom => "noreply@test.com",

        # Mail subject
        #mailSubject => "Password reset",

        # Mail body (can use $password for generated password, and other session infos,
        # like $cn)
        #mailBody => 'Hello $cn,\n\nYour new password is $password',

        # LDAP filter to use
        #mailLDAPFilter => '(&(mail=$mail)(objectClass=inetOrgPerson))',

        # Random regexp
        #randomPasswordRegexp => '[A-Z]{3}[a-z]{5}.\d{2}',

        # LDAP GROUPS
        # Set the base DN of your groups branch
        #ldapGroupBase => 'ou=groups,dc=example,dc=com',
        # Objectclass used by groups
        #ldapGroupObjectClass => 'groupOfUniqueNames',
        # Attribute used by groups to store member
        #ldapGroupAttributeName => 'uniqueMember',
        # Attribute used by user to link to groups
        #ldapGroupAttributeNameUser => 'dn',
        # Attribute used to identify a group. The group will be displayed as
        # cn|mail|status, where cn, mail and status will be replaced by their
        # values.
        #ldapGroupAttributeNameSearch => ['cn'],

82
83
84
85
86
        # CUSTOM FUNCTION
        # If you want to create customFunctions in rules, declare them here:
        #customFunctions    => 'function1 function2',
        #customFunctions    => 'Package::func1 Package::func2',

87
88
89
        # NOTIFICATIONS SERVICE
        # Use it to be able to notify messages during authentication
        #notification => 1,
Yadd's avatar
Yadd committed
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
        # Note that the SOAP function newNotification will be activated on
        # http://auth.example.com/index.pl/notification
        # If you want to hide this, just protect "/index.pl/notification" in
        # your Apache configuration file

        # CROSS-DOMAIN
        # If you have some handlers that are not registered on the main domain,
        # uncomment this
        #cda => 1,

        # XSS protection bypass
        # By default, the portal refuse redirections that comes from sites not
        # registered in the configuration (manager) except for those coming
        # from trusted domains. By default, trustedDomains contains the domain
        # declared in the manager. You can set trustedDomains to empty value so
        # that, undeclared sites will be rejected. You can also set here a list
        # of trusted domains or hosts separated by spaces. This is usefull if
        # your website use Lemonldap::NG without handler with SOAP functions.
        # Exemples :
        #trustedDomains => 'my.trusted.host example2.com',
        #trustedDomains => '',
111

112
113
114
        # OTHERS
        # You can also overload any parameter issued from manager
        # configuration. Example:
Yadd's avatar
Yadd committed
115
        #globalStorage => 'Apache::Session::File',
116
        #globalStorageOptions => {
Yadd's avatar
Yadd committed
117
118
119
120
121
        #  'Directory' => '/var/lib/lemonldap-ng/sessions/'
        #  'LockDirectory' => '/var/lib/lemonldap-ng/sessions/lock/'
        #}
        # Note that YOU HAVE TO SET globalStorage here if you've declared this
        # portal as SOAP session server in the manager
122
        #},
123
124
125
126
    }
);

if ( $portal->process() ) {
127
    print $portal->header('text/html; charset=utf-8');
128
    print $portal->start_html;
129
    print "<h1>You are well authenticated !</h1>";
130
131
132
133
    print "Click <a href=\"$ENV{SCRIPT_NAME}?logout=1\">here</a> to logout";
    print $portal->end_html;
}
else {
134
    print $portal->header('text/html; charset=utf-8');
135
136
    print $portal->start_html;
    print 'Error: ' . $portal->error . '<br />';
137
    print '<form method="post" action="' . $ENV{SCRIPTNAME} . '">';
Yadd's avatar
Yadd committed
138
    print '<input type="hidden" name="url" value="' . $portal->get_url . '" />';
139
    print 'Login : <input name="user" /><br />';
140
141
    print
'Password : <input name="password" type="password" autocomplete="off"><br>';
142
143
144
145
146
    print '<input type="submit" value="OK" />';
    print '</form>';
    print $portal->end_html;
}