smallrye / smallrye-jose

Apache License 2.0
1 stars 1 forks source link

Implement Jose API #1

Open sberyozkin opened 5 years ago

sberyozkin commented 5 years ago

Jose API will be initially based on the Thorntail Jose API.

The only change I'm planning around that API initially is to to introduce typed sign/verify/encrypt/decrypt overloads which will be supported by an interface like TypeConverter which will (de)serialize a given type to/from String. For example, smallrye-jwt would provide a TypedConverter<JsonWebToken> and then one would write jose.sign(new TestJsonWebToken()) or JsonWebToken jwt = jose.verify(jwsSequence, JsonWebToken.class) or jose.encrypt(new TestJsonWebToken()) or JsonWebToken jwt = jose.decrypt(jweSequence, JsonWebToken.class), etc.

String, JSONB will be supported OOB in/out. InputStream - on the input though initially it will be internally buffered, the streaming support will be added later as only the best effort is possible to stream and build the JWS and especially JWE at the same time.

Injecting an interface similar to Jose should only be one of the options - finer-grained options should be available such as Jws, Jwe (the former would be composed from Signer and Verificator and the latter from Encryptor and Decryptor) and Jose itself from Jws and Jwe. The goal is is to let users inject the Jose interfaces supporting only what the user code needs to do, example, if the code only signs then injecting `Signer' only would be enough.

JWS and JWE builders will be introduced in the next phase

sberyozkin commented 5 years ago

Initial layout is here.

sberyozkin commented 5 years ago

TypeConverter affects API like this.