-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a571a7
commit 35e5c79
Showing
4 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{% set pagetitle = 'AttributeAuthority tester'|trans %} | ||
{% extends 'base.twig' %} | ||
|
||
{% block content %} | ||
<h2>{{ pagetitle }}</h2> | ||
|
||
<form class="pure-form pure-form-aligned" action="test.php" method="POST"> | ||
<fieldset> | ||
<div class="pure-control-group"> | ||
<label for="aligned-name">sp</label> | ||
<select name="sp" id="sp"> | ||
{% for entityid, entitydata in sps %} | ||
<option value="{{ entityid }}">{{ entityid }}</option> | ||
{% endfor %} | ||
</select> | ||
</div> | ||
<legend>Key attribute</legend> | ||
<div class="pure-control-group"> | ||
<label for="aligned-name">name</label> | ||
<input type="text" name="keyattributename" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.6"/> | ||
<label for="aligned-name">value</label> | ||
<input type="text" name="keyattributevalue"/> | ||
</div> | ||
<div class="pure-controls"> | ||
<button type="submit" class="pure-button pure-button-primary">Test</button> | ||
</div> | ||
</fieldset> | ||
</form> | ||
|
||
{% set items = attributes %} | ||
{% embed '_table.twig' -%} | ||
{% block namecol -%} | ||
{% set translated = name|trans %} | ||
<td class="attrname">{% if translated != name %} {{ translated }} <br>{% endif %} <samp>{{ name }}</samp> | ||
</td> | ||
{% endblock %} | ||
|
||
{% block value -%} | ||
{{ value }} | ||
{% endblock %} | ||
{%- endembed %} | ||
|
||
<h4>configauthproc</h4> | ||
<table id="authproc_table" class="attributes pure-table pure-table-striped pure-table-attributes" | ||
summary="authproc overview"> | ||
|
||
{% for name, value in configauthproc %} | ||
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}"> | ||
{% block namecol -%} | ||
<td class="attrname">{{ name }}</td> | ||
{%- endblock %} | ||
<td class="attrvalue"> | ||
{% block value %} | ||
{{ value.class }} | ||
{% endblock %} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table><br> | ||
|
||
{% set items = processedattributes %} | ||
{% embed '_table.twig' -%} | ||
{% block namecol -%} | ||
{% set translated = name|trans %} | ||
<td class="attrname">{% if translated != name %} {{ translated }} <br>{% endif %} <samp>{{ name }}</samp> | ||
</td> | ||
{% endblock %} | ||
|
||
{% block value -%} | ||
{{ value }} | ||
{% endblock %} | ||
{%- endembed %} | ||
|
||
|
||
{% if debug %} | ||
<h4>debug</h4> | ||
<code> | ||
{{ debug }} | ||
</code> | ||
{% endif %} | ||
|
||
{% if exception %} | ||
<h4>exception</h4> | ||
<pre> | ||
{{ exception }} | ||
</pre> | ||
{% endif %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* | ||
* @author [email protected] | ||
* @author [email protected] | ||
* @package | ||
*/ | ||
|
||
require_once('_include.php'); | ||
|
||
SimpleSAML\Utils\Auth::requireAdmin(); | ||
SimpleSAML\Logger::info('SAML2.0 - AA Server: access testpage'); | ||
|
||
$t = new SimpleSAML\XHTML\Template($config, 'aa:status.php'); | ||
$t->getTwig()->enableDebug(); | ||
$t->getTwig()->addExtension(new Twig\Extension\DebugExtension()); | ||
|
||
$metadata = SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); | ||
|
||
$aaEntityId = $metadata->getMetaDataCurrentEntityID('attributeauthority-hosted'); | ||
$aaMetadata = $metadata->getMetadataConfig($aaEntityId, 'attributeauthority-hosted'); | ||
|
||
$config = \SimpleSAML\Configuration::getInstance(); | ||
$configauthproc = $config->getArray('authproc.aa', null); | ||
$t->data['configauthproc'] = $configauthproc; | ||
|
||
$spMetadatas = $metadata->getList('saml20-sp-remote'); | ||
$t->data['sps'] = $spMetadatas; | ||
|
||
$attributes = []; | ||
|
||
try { | ||
if ($_POST['keyattributename'] && $_POST['keyattributevalue']) { | ||
$attributes[$_POST['keyattributename']] = [0 => $_POST['keyattributevalue']]; | ||
} | ||
$t->data['attributes'] = $attributes; | ||
|
||
if ($_POST['sp']) { | ||
$spEntityId = $_POST['sp']; | ||
$spMetadataArray = $metadata->getMetaData($spEntityId, 'saml20-sp-remote'); | ||
$pc = new \SimpleSAML\Auth\ProcessingChain($aaMetadata->toArray(), $spMetadataArray, 'aa'); | ||
$authProcState = [ | ||
'Attributes' => $attributes, | ||
'Destination' => $spMetadataArray, | ||
'Source' => $aaMetadata->toArray(), | ||
]; | ||
$pc->processStatePassive($authProcState); | ||
$processedattributes = $authProcState['Attributes']; | ||
$t->data['processedattributes'] = $processedattributes; | ||
} | ||
|
||
} catch (Exception $exception) { | ||
$t->data['exception'] = $exception->getMessage(); | ||
$t->send(); | ||
} | ||
|
||
if (!empty($debug)) { | ||
$t->data['debug'] = var_export($debug, true); | ||
} | ||
|
||
$t->send(); |