Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev branch: resolve route with @domain missing. #30

Open
unicg opened this issue Nov 8, 2024 · 0 comments
Open

dev branch: resolve route with @domain missing. #30

unicg opened this issue Nov 8, 2024 · 0 comments

Comments

@unicg
Copy link

unicg commented Nov 8, 2024

Hi!

In dev branch on file www/index.php the resolve route with @Domain is missing.

// GET /resolve
$f3->route(
[
'GET /resolve'
],
function ($f3) {
$domain = $f3->get("PARAMS.domain") ? $f3->get("PARAMS.domain") : 'default';
$config = $f3->get("CONFIG")['rp_proxy_clients'][$domain];
$sub = $f3->get("GET.sub");
$anchor = $f3->get("GET.anchor");
if (empty($sub) || empty($anchor)) {
$f3->error(400, "anchor or sub not not found");
}
$rp_database = $f3->get("RP_DATABASE");
$logger = $f3->get("LOGGER");
$mediaType = 'application/entity-statement+jwt';
header('Content-Type: ' . $mediaType);
$response = ResolveEndpoint::resolve($config, $rp_database, $sub, $anchor);
echo $response;
$logger->log('spid-cie-oidc-php', 'GET /resolve', $_GET, $response);
}
);

Maybe this should be changed like this:

// GET /resolve
// GET /@domain/resolve
$f3->route(
    [
    'GET /resolve',
    'GET /@domain/resolve'
    ],
    function ($f3) {
        $domain = $f3->get("PARAMS.domain") ? $f3->get("PARAMS.domain") : 'default';
        $config = $f3->get("CONFIG")['rp_proxy_clients'][$domain];
        // ...
    }
);

Do ResolveEndpoint.php need more code?

// TODO
class ResolveEndpoint
{
/**
* creates a new ResolveEndpoint instance
*
* @param string $sub entity
* @param string $anchor Trust Anchor
* @throws Exception
* @return ResolveEndpoint
*/
public function __construct($sub = null, $anchor = null)
{
if ($sub != null && $anchor != null) {
$this->sub = $sub;
$this->anchor = $anchor;
//$this->payload = JWT::getJWSPayload($this->token);
//$this->validate($token);
}
}
public static function resolve($config, $db, $sub, $anchor)
{
$key = $config['cert_private_fed_sig'];
$key_jwk = JWT::getJWKFromJSON(file_get_contents($key));
$header = array(
"typ" => "entity-statement+jwt",
"alg" => "RS256",
"kid" => $key_jwk->get('kid')
);
$jws = JWT::makeJWS($header, array("test"), $key_jwk);
return $jws;
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant