Skip to main content
100%

DPoP on browser with Rails

✓ Published0🌍 Public
WWilliamNHarvey
Last edited Aug 8, 2022
Created on Aug 8, 2022

This example shows a Rails controller implementing the DPoP (Demonstrating Proof of Possession) protocol for browser requests to a resource server. The controller’s `index` and `create` actions build an HTTPS request to a hardcoded URI, generating a DPoP proof via the `Dpop::Controller` mixin’s `get_proof` method, which takes the HTTP method and a sanitized `htu` (URI with query and fragment stripped). The proof is attached as the `dpop` header alongside a bearer token in the `authorization` header, using Ruby’s `Net::HTTP` to send the request and store the response body in `@data`.

AI-generated description

Similar vizzes