Apache2-AuthCAS

 view release on metacpan or  search on metacpan

lib/Apache2/AuthCAS.pm  view on Meta::CPAN

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
        "ProxyUri"                => "/cas/proxy",
        "ProxyValidateUri"        => "/cas/proxyValidate",
        "ServiceValidateUri"      => "/cas/serviceValidate",
 
        "LogLevel"                => 0,
        "PretendBasicAuth"        => 0,
        "Service"                 => undef,
        "ProxyService"            => undef,
        "ErrorUrl"                => "http://localhost/cas/error/",
        "SessionCleanupThreshold" => 10,
        "SessionCookieName"       => "APACHECAS",
        "SessionCookieDomain"     => undef,
        "SessionCookieSecure"     => 0,
        "SessionTimeout"          => 1800,
        "RemoveTicket"            => 0,
        "NumProxyTickets"         => 0,
 
        "DbDriver"                => "Pg",
        "DbDataSource"            => "dbname=apache_cas;host=localhost;port=5432",
        "DbSessionTable"          => "cas_sessions",
        "DbUser"                  => "cas",
        "DbPass"                  => "cas",
);

lib/Apache2/AuthCAS.pm  view on Meta::CPAN

196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
my %params = $self->parse_query_parameters($uri->query);
 
# Check for a proxy receptor call
if ($params{'pgt'} and $params{'pgtIou'})
{
    return $self->proxy_receptor($params{'pgtIou'}, $params{'pgt'});
}
 
# Check for a session cookie
if (my $cookie = $r->headers_in->{'Cookie'})
{
    # we have a session cookie, so we need to get the session id
    $self->logMsg("cookie found: '$cookie'", $LOG_DEBUG);
 
    # get session id from the cookie
    my $cookieName = $self->casConfig("SessionCookieName");
    $cookie =~ /.*$cookieName=([^;]+)(\s*;.*|\s*$)/;
    my $sid = $1;
    $self->logMsg(($sid ? "" : "no") . " session id found", $LOG_DEBUG);
 
    # Check for a valid session id
    if ($sid and defined(my $rc = $self->check_session($sid)))
    {
        return $rc;
    }
}

lib/Apache2/AuthCAS.pm  view on Meta::CPAN

239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# map a new session id to this pgtiou and give the client a cookie
my $sid = $self->create_session($user, $pgtiou, $ticket);
 
if (!$sid)
{
    # if something bad happened, like database unavailability
    return $self->redirect($self->casConfig("ErrorUrl"), $ERROR_CODES{"DB"});
}
 
my $cookie = $self->casConfig("SessionCookieName") . "=$sid;path=/";
if ($self->casConfig("SessionCookieDomain"))
{
    $cookie .= ";domain=." . $self->casConfig("SessionCookieDomain");
}
if ($self->casConfig("SessionCookieSecure"))
{
    $cookie .= ";secure";
}
 
# send the cookie to the browser
$self->setHeader(0, 'Set-Cookie', $cookie);
 
# in case we redirect (considered an "error")
$r->err_headers_out->{"Set-Cookie"} = $cookie;
 
if ($self->casConfig("ProxyService"))
{
    return $self->do_proxy($sid, undef, $user, 1);
}
else
{
    $self->setHeader(1, 'CAS_FILTER_USER', $user);
    $self->add_basic_auth($user);

lib/Apache2/AuthCAS.pm  view on Meta::CPAN

1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
CASErrorUrl                 "http://localhost/cas/error/"
 
# Session cleanup threshold (1 in N requests)
# Session cleanup will occur for each Apache thread or process -
#   i.e. for 10 processes, it may take as many as 100 requests before
# session cleanup is performed with a threshold of 10)
 
CASSessionCleanupThreshold  10
 
# Session cookie configuration for this service
CASSessionCookieDomain      ""
CASSessionCookieName        "APACHECAS"
CASSessionTimeout           1800
 
# Should the ticket parameter be removed from the URL?
CASRemoveTicket             0
 
# Optional override for this service name
CASService                  ""
 
# If you are proxying for a backend service you will need to specify
# these parameters.  The service is the name of the backend service

lib/Apache2/AuthCAS.pm  view on Meta::CPAN

1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
            last_accessed  int8        not null,
            user_id        varchar(32) not null,
            pgtiou         varchar(256),
            pgt            varchar(256)
            service_ticket varchar(256)
        );
    Add indexes and adjust as appropriate for your database and usage.
 
SSL
 
    Be careful not to use the CASSessionCookieSecure flag with an HTTP resource.
    If this flag is set and the protocol is HTTP, then no cookie will get sent
    to Apache and Apache2::AuthCAS may act very strange.
    Be sure to set CASSessionCookieSecure only on HTTPS resources!
 
=head1 COMPATIBILITY
 
This module will only work with mod_perl2.  mod_perl1 is not supported.
 
=head1 SEE ALSO
 
=head2 Official JA-SIG CAS Website
 

lib/Apache2/AuthCAS/Configuration.pm  view on Meta::CPAN

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    { cmd_data => 'ProxyUri',                err_append => 'uri',           },
    { cmd_data => 'ProxyValidateUri',        err_append => 'uri',           },
    { cmd_data => 'ServiceValidateUri',      err_append => 'url',           },
 
    { cmd_data => 'LogLevel',                err_append => 'uri',           },
    { cmd_data => 'PretendBasicAuth',        err_append => '0/1',           },
    { cmd_data => 'Service',                 err_append => 'url',           },
    { cmd_data => 'ProxyService',            err_append => 'url',           },
    { cmd_data => 'ErrorUrl',                err_append => 'uri',           },
    { cmd_data => 'SessionCleanupThreshold', err_append => 'number',        },
    { cmd_data => 'SessionCookieName',       err_append => 'name',          },
    { cmd_data => 'SessionCookieDomain',     err_append => 'name',          },
    { cmd_data => 'SessionCookieSecure',     err_append => '0/1',           },
    { cmd_data => 'SessionTimeout',          err_append => 'name',          },
    { cmd_data => 'RemoveTicket',            err_append => '0/1',           },
    { cmd_data => 'NumProxyTickets',         err_append => 'number',        },
 
    { cmd_data => 'DbDriver',                err_append => 'driver',        },
    { cmd_data => 'DbDataSource',            err_append => 'string',        },
    { cmd_data => 'DbSessionTable',          err_append => 'session_table', },
    { cmd_data => 'DbUser',                  err_append => 'username',      },
    { cmd_data => 'DbPass',                  err_append => 'password',      },
);



( run in 0.317 second using v1.01-cache-2.11-cpan-05444aca049 )