1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
|
#! /usr/bin/php
<?php
$ret = @dl('lasso.' . PHP_SHLIB_SUFFIX);
if ($ret == FALSE) {
print "lasso not found\n";
exit(1);
}
function create_authnresponse($query)
{
$server = new LassoServer(
"../../tests/data/idp1-la/metadata.xml",
"../../tests/data/idp1-la/private-key-raw.pem",
NULL,
"../../tests/data/idp1-la/certificate.pem");
$server->addProvider(LASSO_PROVIDER_ROLE_SP,
"../../tests/data/sp1-la/metadata.xml",
"../../tests/data/sp1-la/public-key.pem",
"../../tests/data/ca1-la/certificate.pem");
$login = new LassoLogin($server);
$login->processAuthnRequestMsg(substr(strstr($query, "?"),1));
$login->validateRequestMsg(1, 1);
$login->buildAssertion(LASSO_SAML_AUTHENTICATION_METHOD_PASSWORD,
"later", "reauthnonorafter", "notbefore", "notonorafter");
$login->buildAuthnResponseMsg();
return $login->msgBody;
}
lasso_init();
$server = new LassoServer(
"../../tests/data/sp1-la/metadata.xml",
"../../tests/data/sp1-la/private-key-raw.pem",
NULL,
"../../tests/data/sp1-la/certificate.pem");
$server->addProvider(LASSO_PROVIDER_ROLE_IDP,
"../../tests/data/idp1-la/metadata.xml",
"../../tests/data/idp1-la/public-key.pem",
"../../tests/data/ca1-la/certificate.pem");
$login = new LassoLogin($server);
printf("Generating 50 AuthnRequest...\n");
for ($i=0; $i < 50; $i++) {
$login->initAuthnRequest("https://idp1/metadata", LASSO_HTTP_METHOD_REDIRECT);
$request = $login->request;
$request->ForceAuthn = true;
$request->IsPassive = false;
$request->NameIDPolicy = LASSO_LIB_NAMEID_POLICY_TYPE_FEDERATED;
$request->ProtocolProfile = LASSO_LIB_PROTOCOL_PROFILE_BRWS_POST;
$login->buildAuthnRequestMsg();
}
$query = $login->msgUrl;
$authn_response_msg = create_authnresponse($query);
printf("Processing 50 AuthnResponse...\n");
for ($i=0; $i < 50; $i++) {
$login->processAuthnResponseMsg($authn_response_msg);
$login->acceptSso();
}
?>
|