From 10a83c6ad8415807e6b64fa94614f713ec58c612 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Wed, 14 Jun 2017 16:26:31 +0200 Subject: [PATCH] Added possibility to create JWS object with specific algo hs256 or none easily. --- library/security/jwt/src/jws.e | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/library/security/jwt/src/jws.e b/library/security/jwt/src/jws.e index 37067915..82a7578a 100644 --- a/library/security/jwt/src/jws.e +++ b/library/security/jwt/src/jws.e @@ -1,6 +1,5 @@ note description: "Summary description for {JWS}." - author: "" date: "$Date$" revision: "$Revision$" @@ -9,19 +8,35 @@ class inherit JWT + redefine + default_create + end JWT_UTILITIES - undefine + redefine default_create end create default_create, + make_with_algorithm, make_with_claims, make_with_json_payload feature {NONE} -- Initialization + default_create + do + Precursor {JWT} + set_algorithm_to_hs256 + end + + make_with_algorithm (alg: like algorithm) + do + default_create + set_algorithm (alg) + end + make_with_claims (tb: STRING_TABLE [READABLE_STRING_GENERAL]) do default_create @@ -77,4 +92,14 @@ feature -- Element change header.set_algorithm (alg) end + set_algorithm_to_hs256 + do + set_algorithm (alg_hs256) + end + + set_algorithm_to_none + do + set_algorithm (alg_none) + end + end