REST-API

Authentication

REST authentication happens via OAuth.simplesamlphp has a quite RESTful approach to getting these tokens, so that infrastructure can be reused

Get a request token

Endpoint

GET /api/oauth.php/request

Parameters

Encoding: www-url-encoded (e.g. ?oauth_version1.0&oauth_nonce=25f408ab389...&...)

Returns

Encoding: www-url-encoded (e.g. oauth_token=bla&oauth_token_secret=bla2)

Success:

Error:

 

Authorize a request token

Endpoint

GET /api/oauth.php/authorize
! Note that you have to use Confusa's authorization endpoint, because that one authorizes more data (currently the attributes + the IdP name) than the simplesamlphp authorization endpoint. The IdP information is needed in Confusa to deduce the appropriate NREN, which is needed to know which attribute mapping Confusa should take !

Parameters

Returns

Encoding: www-url-encoded (e.g. ?oauth_token=_b5d7...)

Success:

Error:

 

Note: If the user is already authenticated with the default-sp and OAuth is configured to use the default-sp, this call will be successful in the browser immediately. However, there remains the inconvenience to open the same browser window in which the Confusa authentication was made. A possibility to circumvent this is to create an OAuth request token in Confusa and let the user authorize it upon starting the application and pass the resulting access token to the application.

 

Get an access token

Endpoint

GET /api/oauth.php/access

Parameters

Encoding: www-url-encoded (e.g. ?oauth_version1.0&oauth_nonce=25f408ab389...&...)

Returns

Encoding: www-url-encoded (e.g. ?oauth_token=_2345...&oauth_token_secret=_235556....)

Success:

Error:

Certificate request

Request a new certificate from a PKCS#10 request

POST /api/certificates.php

Parameters

Encoding: POST XML (e.g. ?request=<signingRequest><csr>-----BEGIN...</signingRequest>)

   <signingRequest>
<csr>PKCS#10 CSR</csr>
<emails>
<email>donald@duckburg.dk</email>
<email>nospam@mailnator.com</email>
</emails>
</signingRequest>

The E-Mails are the e-mail addresses that are to be included as SANs in the certificate. The RelaxNG schema that the request should follow is available here.

Returns

Encoding: www-url-encoded (e.g. auth_key=2345667)

Success:

Error:

 

Certificate download

Download a single certificate

GET /api/certificates.php/<auth_key>/<format> (e.g. GET /api/certificates/8495866/pkcs7)

Examples

Return a default - PKCS#7 - encoded certificate with identifier 8495866:

GET /api/certificates.php/8495866

Return a certificate with the complete chain (cert + CA bundle) with identifier 8495866:

GET /api/certificates.php/8495866/pkcs7_cabundle

Return a certificate in cmmf encoding with identifier 8495866:

GET /api/certificates.php/8495866/cmmf

Parameters

Encoding: www-url-encoded (e.g. auth_key=2345667)

Returns

Encoding: www-url-encoded (e.g. cert=<PKCS#7 blob>) and/or XML e.g. <certificate-content>PKCS#7-blob</certificate-content>

Success:

Error:

Certificate listing

List all certificates of a user

GET /api/certificates.php/

Parameters

Encoding: www-url-encoded

Returns

Encoding: XML (+JSON?) e.g.

<certificates>
<certificate>
<id>/api/certificates/8495866</id>
<status>Processed</status>
<beginDate>2009-10-20</beginDate>
<endDate>2010-11-20</endDate>
</certificate>
<certificate>
<id>...
</certificate>
</certificates>


RelaxNG schema for the response.

Success:

Error:

 

Information endpoint

Get the subject DN of certificates of the AuthN user

GET /api/infopoint.php/dn/<format>

Examples

Get the DN in OpenSSL encoding (/C=SE/O=Kiruna Mining School/CN=Sven Svensson)

GET /api/infopoint.php/dn/openssl

Get the DN in RFC2253 encoding (CN=Sven Svensson, O=Kiruna Mining School, C=SE)

GET /api/infopoint.php/dn/rfc2253

Parameters

Encoding: www-url-encoded

Returns

Encoding: www-url-encoded

Success:

Error:

Get the attributes of the authN user

GET /api/infopoint.php/user

Parameters

Encoding: www-url-encoded

Returns

Encoding: XML, e.g

<user>
<uid>jdoe@example.org</uid>
<cn>John Doe</cn>
<orgDN>hogwarts</orgDN>
<orgID>dc=hwww,dc=wiz</orgID>
<emails>
<email>putter@hwww.wiz</email>
</emails>
<nren>magiccouncil</nren>
<country>wi</country>
<entitlements>
<entitlement>witchcraft</entitlement>
<entitlement>whitemagic</entitlement>
</entitlements>
</user>

RelaxNG schema for the response.

Success:

Error:

Same as infopoint.php/dn