JavaScript running on the client takes over submission of the certificate signing request. However, it sends it to us via AJAX, where we then submit to the CA, receive the certificate, and then send back to the client.

So we need to add a route & handler for this.

Comments

colan created an issue. See original summary.

colan’s picture

Assigned: Unassigned » colan
colan’s picture

Version: » 8.x-1.x-dev

Drupal Console should get us going with drupal generate:plugin:rest:resource.

We may also need to write a plug-in using the Authentication API as "basic authentication" definitely won't cut it, and "cookies" may not either, but needs testing. Or if we can't use cookies, maybe we can find an existing contrib module.

colan’s picture

emboss wrote:

Yes, POST is good. The payload is JSON in the form { csr: <String>, profile: <String> }. This needs to be proxied to the CA API (also POST). The JSON response from the CA API has the form { certificate: <String>, ca_certificates: [ <String>, <String>, ...] }. Proxy the response to the JS caller.

colan’s picture

For now, we're just going to use the "cookie" authentication provider. This is user-account access, but we'll allow anonymous users as per the Permissions at https://www.drupal.org/docs/8/api/restful-web-services-api/restful-web-s..., and then do our own authentication via PKIRACertificateSigningRequestProcessor::requestIsAuthenticated() at the start of the post() method in the resource class.

Later, we can come up with an Authentication Provider using drupal generate:authentication:provider along with these guides:

Could also create a new contrib module for it and publish at Using other authentication protocols.

  • colan committed 40dcbf3 on 8.x-1.x
    Issue #2849338 by colan: Merge branch 'issue-2849338' into 8.x-1.x
    
colan’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.