コード例 #1
0
ファイル: sessions.php プロジェクト: lightsaml/lightsaml-idp
<?php

require_once __DIR__ . '/_config.php';
$buildContainer = IdpConfig::current()->getBuildContainer();
$ssoState = $buildContainer->getStoreContainer()->getSsoStateStore()->get();
foreach ($ssoState->getSsoSessions() as $ssoSession) {
    print "<ul>\n";
    print "<li>IDP: " . $ssoSession->getIdpEntityId() . "</li>\n";
    print "<li>SP: " . $ssoSession->getSpEntityId() . "</li>\n";
    print "<li>NameID: " . $ssoSession->getNameId() . "</li>\n";
    print "<li>NameIDFormat: " . $ssoSession->getNameIdFormat() . "</li>\n";
    print "<li>SessionIndex: " . $ssoSession->getSessionIndex() . "</li>\n";
    print "<li>AuthnInstant: " . $ssoSession->getSessionInstant()->format('Y-m-d H:i:s P') . "</li>\n";
    print "<li>FirstAuthOn: " . $ssoSession->getFirstAuthOn()->format('Y-m-d H:i:s P') . "</li>\n";
    print "<li>LastAuthOn: " . $ssoSession->getLastAuthOn()->format('Y-m-d H:i:s P') . "</li>\n";
    print "</ul>\n";
}
if (empty($ssoState->getSsoSessions())) {
    print "<p>No sessions established</p>\n";
}
コード例 #2
0
ファイル: initiate.php プロジェクト: lightsaml/lightsaml-idp
<?php

require_once __DIR__ . '/_config.php';
$spEntityId = @$_GET['sp'];
if (null == $spEntityId) {
    header('Location: discovery.php');
    exit;
}
$spEntityDescriptor = IdpConfig::current()->getBuildContainer()->getPartyContainer()->getSpEntityDescriptorStore()->get($spEntityId);
if (null == $spEntityDescriptor) {
    header('Location: discovery.php');
    exit;
}
$buildContainer = IdpConfig::current()->getBuildContainer();
$criteriaSet = new \LightSaml\Criteria\CriteriaSet([new \LightSaml\Resolver\Endpoint\Criteria\BindingCriteria([\LightSaml\SamlConstants::BINDING_SAML2_HTTP_POST]), new \LightSaml\Resolver\Endpoint\Criteria\DescriptorTypeCriteria(\LightSaml\Model\Metadata\SpSsoDescriptor::class), new \LightSaml\Resolver\Endpoint\Criteria\ServiceTypeCriteria(\LightSaml\Model\Metadata\AssertionConsumerService::class)]);
$arrEndpoints = IdpConfig::current()->getBuildContainer()->getServiceContainer()->getEndpointResolver()->resolve($criteriaSet, $spEntityDescriptor->getAllEndpoints());
if (empty($arrEndpoints)) {
    throw new \RuntimeException(sprintf('SP party "%s" does not have any SP ACS endpoint defined', $spEntityId));
}
$endpoint = $arrEndpoints[0]->getEndpoint();
$trustOptions = IdpConfig::current()->getBuildContainer()->getPartyContainer()->getTrustOptionsStore()->get($spEntityId);
$sendBuilder = new \LightSaml\Idp\Builder\Profile\WebBrowserSso\Idp\SsoIdpSendResponseProfileBuilder($buildContainer, array(new \LightSaml\Idp\Builder\Action\Profile\SingleSignOn\Idp\SsoIdpAssertionActionBuilder($buildContainer)), $spEntityId);
$sendBuilder->setPartyEntityDescriptor($spEntityDescriptor);
$sendBuilder->setPartyTrustOptions($trustOptions);
$sendBuilder->setEndpoint($endpoint);
$context = $sendBuilder->buildContext();
$action = $sendBuilder->buildAction();
$action->execute($context);
$context->getHttpResponseContext()->getResponse()->send();
コード例 #3
0
ファイル: metadata.php プロジェクト: lightsaml/lightsaml-idp
<?php

require_once __DIR__ . '/_config.php';
$builder = new \LightSaml\Builder\Profile\Metadata\MetadataProfileBuilder(IdpConfig::current()->getBuildContainer());
$context = $builder->buildContext();
$action = $builder->buildAction();
//print "<pre>\n";
//print_r($action->debugPrintTree());
//
//exit;
$action->execute($context);
$context->getHttpResponseContext()->getResponse()->send();
コード例 #4
0
ファイル: discovery.php プロジェクト: lightsaml/lightsaml-idp
<?php

require_once __DIR__ . '/_config.php';
$all = IdpConfig::current()->getBuildContainer()->getPartyContainer()->getSpEntityDescriptorStore()->all();
switch (count($all)) {
    case 0:
        print "None SP configured";
        exit;
    case 1:
        header('Location: login.php?idp=' . $all[0]->getEntityID());
        exit;
}
print "<h1>Following SPs are configured</h1>\n";
print "<p><small>Choose one for IDP initiated SSO</small></p>\n";
foreach ($all as $idp) {
    if ($idp->getAllSpSsoDescriptors()) {
        print "<p><a href=\"initiate.php?sp={$idp->getEntityID()}\">{$idp->getEntityID()}</a></p>\n";
    }
}
print "\n<p>LigthSAML-IDP</p>\n";