uchicago / shibboleth-oidc

OpenID Connect support for the Shibboleth Identity Provider v3
Apache License 2.0
81 stars 19 forks source link

OIDC Client for Shib SPs #10

Closed mmoayyed closed 1 year ago

mmoayyed commented 9 years ago

@mmoayyed and @langedb had a very lively and wildly successful and productive discussion on the native SP backdoor functionality acting as an OIDC client for Shibboleth SPs. Add a summary of that to the roadmap.

langedb commented 9 years ago

Here's the code I was talking about that you use after you configure the External Auth handler on the SP

<?php
$url = "http://localhost/Shibboleth.sso/External";

$postData = array(
        'NameID' => 'dave@thelangenbergs.com',
        'attributes' => 'mail,cn',
        'cn' => 'David Langenberg',
        'address' => urlencode($_SERVER["REMOTE_ADDR"]),
        'mail' => 'davel@uchicago.edu'
);

$ch = curl_init();

curl_setopt_array($ch,array(
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER=>true,
        CURLOPT_POST => true,
        CURLOPT_COOKIESESSION => true,
        CURLOPT_POSTFIELDS => http_build_query($postData)
        )
);
$output = curl_exec($ch);

#turn the returned XML into an array
$ob = simplexml_load_string($output);
$json = json_encode($ob);
$array = json_decode($json,true);

header('Set-cookie: '.$array['Cookie']);

header('Location: /secure');
?>