Skip to content

Commit

Permalink
initial text on endpoint; change encoding example to include the requ…
Browse files Browse the repository at this point in the history
…ired members
  • Loading branch information
c2bo committed Aug 14, 2023
1 parent 62c506f commit 73c0522
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
13 changes: 11 additions & 2 deletions draft-looker-oauth-jwt-cwt-status-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ normative:
RFC3986: RFC3986
RFC1952: RFC1952
RFC7515: RFC7515
RFC6125: RFC6125
RFC9111: RFC9111
RFC9110: RFC9110
informative:

--- abstract
Expand Down Expand Up @@ -271,7 +274,7 @@ The following example is the decoded header and payload of a JWT meeting the pro

## Status List Request

To obtain the Status List or Status List Token, the Verifier MUST send a HTTP GET request to the Status List Endpoint. Communication with the Status List Endpoint MUST utilize TLS.
To obtain the Status List or Status List Token, the Verifier MUST send a HTTP GET request to the Status List Endpoint. Communication with the Status List Endpoint MUST utilize TLS. Which version(s) should be implemented will vary over time. A TLS server certificate check MUST be performed as defined in Section 5 and 6 of {{RFC6125}}.

The Verifier SHOULD send the following Accept-Header to indicate the requested response type:
- "application/statuslist+json" for Status Lists
Expand All @@ -285,9 +288,15 @@ In the successful response, the Status List Provider MUST use the following cont
- "application/statuslist+json" for Status Lists
- "application/statuslist+jwt" for Status List JWTs

In the case of "application/statuslist+json", the response MUST be of type JSON and follow the rules of [](#jwt-status-list-claim-format).

In the case of "application/statuslist+jwt", the response MUST be of type JWT and follow the rules of [](#jwt-status-list-format-and-processing).

The response SHOULD use gzip Contente-Encoding as defined in {{RFC9110}}.

## Caching

TDB use HTTP chaching mechanisms
If caching is required (e.g., to enable the use of alternative mechanisms for hosting, like Content Delivery Networks), the control of the caching mechanism SHOULD be implemented using the standard HTTP Cache-Control as defined in {{RFC9111}}.

## Validation Rules

Expand Down
14 changes: 8 additions & 6 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ def statusListEncoding1Bit():
status_list.set(13, 1)
status_list.set(14, 0)
status_list.set(15, 1)
encoded = status_list.encode(mtime=gzip_time)
text = 'byte_array = [{}, {}] \nencoded = "{}"'.format(
hex(status_list.list[0]), hex(status_list.list[1]), encoded
encoded = status_list.encodeObject(mtime=gzip_time)
text = "byte_array = [{}, {}] \nencoded:\n{}".format(
hex(status_list.list[0]),
hex(status_list.list[1]),
util.printObject(encoded)
)
util.outputFile(folder + "status_list_encoding", text)

Expand All @@ -55,12 +57,12 @@ def exampleStatusList() -> StatusList:

def statusListEncoding2Bit():
status_list = exampleStatusList()
encoded = status_list.encode(mtime=gzip_time)
text = 'byte_array = [{}, {}, {}] \nencoded = "{}"'.format(
encoded = status_list.encodeObject(mtime=gzip_time)
text = "byte_array = [{}, {}, {}] \nencoded:\n{}".format(
hex(status_list.list[0]),
hex(status_list.list[1]),
hex(status_list.list[2]),
encoded,
util.printObject(encoded),
)
util.outputFile(folder + "status_list_encoding2", text)

Expand Down
10 changes: 10 additions & 0 deletions src/status_list.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from base64 import urlsafe_b64decode, urlsafe_b64encode
from typing import Dict
import gzip


Expand Down Expand Up @@ -44,6 +45,15 @@ def get(self, pos: int) -> int:
return (
self.list[floored] & (((1 << self.bits) - 1) << shift)
) >> shift

def encodeObject(self, mtime=None) -> Dict:
claims = {}
encoded_list = self.encode(mtime=mtime)
claims["status_list"] = {
"bits": self.bits,
"lst": encoded_list,
}
return claims

def __str__(self):
val = ""
Expand Down
5 changes: 5 additions & 0 deletions src/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from jwcrypto import jwk, jwt
from textwrap import fill
from typing import Dict
import json

example = {
Expand All @@ -26,6 +27,10 @@ def formatToken(input: str, key: jwk.JWK) -> str:
{claims}"""


def printObject(input: Dict) -> str:
return printJson(json.dumps(input))


def printJson(input: str) -> str:
text = json.dumps(
json.loads(input), sort_keys=True, indent=2, ensure_ascii=False
Expand Down

0 comments on commit 73c0522

Please sign in to comment.