Giter VIP home page Giter VIP logo

jwskate's People

Contributors

guillaume-pujol avatar guillp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jwskate's Issues

New binapy broke library

  • jwskate version: all
  • Python version: all
  • Operating System: all

Description

x=BinaPy.from_int(x, coord_size).to("b64u").ascii(),
E TypeError: BinaPy.from_int() takes 2 positional arguments but 3 were given

Solution freeze binapy==7

HS* algs yield invalid key sizes

  • jwskate version: 0.5.0
  • Python version: 3.7.9
  • Operating System: Fedora 31

Description

I wanted to create HS512 key.
Generated key was shorter than expected.

(for required length see) https://www.rfc-editor.org/rfc/rfc7518#section-3.2

What I Did

from jwskate import Jwk, Jwt
print(Jwk.generate_for_alg(alg="HS512"))
{'kty': 'oct', 'k': 'OaFBpH2kogyNz-LvmfYYBw', 'alg': 'HS512'}

I created a PR with a fix #6

Creating private_jwk fails in AWS lambda function

  • jwskate version: 0.8.0
  • Python version: 3.7
  • Operating System: Amazon Linux 2 (Lambda function)

Description

I installed the library as a layer and attached it to my lambda function in AWS.
Basically by:

mkdir lambda_layers
cd lambda_layers
mkdir python
cd python
pip install jwskate -t ./
cd ..
zip-r python_modules.zip .

Some stuff is working, but some things are very weird, e.g. executing

from jwskate import Jwk

private_jwk = (
    Jwk.generate(alg="ES256")  # select the signature or encryption alg here
    .with_kid_thumbprint()  # optionally, include a RFC7638 compliant thumbprint as kid
    .with_usage_parameters()  # optionally, include 'use' and 'key_ops'
)

results in:

{
  "errorMessage": "",
  "errorType": "NotImplementedError",
  "stackTrace": [
    "  File \"/var/task/lambda_function.py\", line 11, in lambda_handler\n    Jwk.generate(alg=\"ES256\")  # select the signature or encryption alg here\n",
    "  File \"/opt/python/jwskate/jwk/base.py\", line 1044, in generate\n    raise NotImplementedError\n"
  ]
}

Furthermore I get "type object 'Jwk' has no attribute 'from_pem'" for

private_jwk_from_file = (
        Jwk.from_pem(key, password="Th1s_P@ssW0rD_iS_5o_5tr0nG!")
        .with_usage_parameters(alg="ES256")  # adds back the alg, use and key_ops parameters
        .with_kid_thumbprint()  # adds back the thumbprint as kid
    )

Is there something I did wrong?

Decode example?

This is a great library, just wondering if you could add an example showing how to decode a JWT token.

doc request for a path from (jwkset, jwt_data, algs, iss, aud) to (verified claims)

Here's what I worked out:

from jwskate import Jwt, JwkSet
jwkset = JwkSet(requests.get('https://authenticate.bigasterisk.com/.well-known/pomerium/jwks.json').json())

def bottleGetAgent() -> URIRef:
    pomAssertion = bottle.request.headers.get('X-Pomerium-Jwt-Assertion', None)
    jwt = Jwt(pomAssertion)
    jwt.validate(jwkset['keys'][0],
                 algs=['ES256'], 
                 issuer='authenticate.bigasterisk.com', 
                 audience='bigasterisk.com')
    log.debug('claims=%r', jwt.claims)
    ...

This seems to work, but obviously I don't want the [0] in there. jwkset.verify seems relevant, but it doesn't take any of the values I want to pass in.

FYI , I'm expecting something like jwt.validate(jwkset.find_key_for(jwt), ...) or jwkset.verify(jwt, algs, issuer, audience).

If someone does write this doc, we should ask https://www.pomerium.com/docs/capabilities/getting-users-identity to link to it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.