Skip to content
Snippets Groups Projects

Add Demonstrating Proof of Possession (DPoP) for Personal Access Tokens

Closed Ameya Darshan requested to merge ameya-dpop-backend into master
2 files
+ 7
32
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 0
27
def create_dpop_proof(alg, typ, public_key, private_key, htu: '', htm: '', ath: nil, iat: Time.now.to_i, jti: SecureRandom.uuid)
headers = create_headers(alg, typ, public_key)
payload = create_payload(
htu: htu, htm: htm, ath: ath, iat: iat, jti: jti
)
JWT.encode(payload, private_key, alg, headers)
end
def create_headers(alg, typ, public_key)
{
alg: alg,
typ: typ,
jwk: public_key
}
end
def create_payload(htu:, htm:, ath: nil, iat: Time.now.to_i, jti: SecureRandom.uuid)
{
htu: htu,
htm: htm,
ath: ath,
iat: iat,
jti: jti
}
end
Loading