{"action":"created","issue":{"url":"https://api.github.com/repos/jwtk/jjwt/issues/194","repository_url":"https://api.github.com/repos/jwtk/jjwt","labels_url":"https://api.github.com/repos/jwtk/jjwt/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/jwtk/jjwt/issues/194/comments","events_url":"https://api.github.com/repos/jwtk/jjwt/issues/194/events","html_url":"https://github.com/jwtk/jjwt/pull/194","id":193437724,"number":194,"title":"Added support for pluggable custom Crypto Implementation","user":{"login":"prateeknischal","id":5807820,"avatar_url":"https://avatars.githubusercontent.com/u/5807820?v=3","gravatar_id":"","url":"https://api.github.com/users/prateeknischal","html_url":"https://github.com/prateeknischal","followers_url":"https://api.github.com/users/prateeknischal/followers","following_url":"https://api.github.com/users/prateeknischal/following{/other_user}","gists_url":"https://api.github.com/users/prateeknischal/gists{/gist_id}","starred_url":"https://api.github.com/users/prateeknischal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateeknischal/subscriptions","organizations_url":"https://api.github.com/users/prateeknischal/orgs","repos_url":"https://api.github.com/users/prateeknischal/repos","events_url":"https://api.github.com/users/prateeknischal/events{/privacy}","received_events_url":"https://api.github.com/users/prateeknischal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-12-05T08:31:21Z","updated_at":"2016-12-06T06:35:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jwtk/jjwt/pulls/194","html_url":"https://github.com/jwtk/jjwt/pull/194","diff_url":"https://github.com/jwtk/jjwt/pull/194.diff","patch_url":"https://github.com/jwtk/jjwt/pull/194.patch"},"body":"This commit allows a user to plug their own crypto Implementation to the jjwt library and use it instead of the default provided Crypto layer. This may be required becuase the jjwt expects the user to get a private key to sign the token. But there might be cases that one cannot get the clear private key out, as in some applications (e.g. PCI compliant applications).\r\n\r\nThese applications use a HSM (https://en.wikipedia.org/wiki/Hardware_security_module) for all the encryption and decryption and key management. So the application never has access to clear keys, but only a handle. As far as I know there is no mechanism in the current build to have tokens instead of actual clear Key for crypto functions. Also the library relies completely on the default crypto layer provided. there must a mechanism to set custom crypto implementations that is flexible enough to accept tokens / blobs of actual keys and delegate the crypto functions to the centralised module (eg HSM). \r\n\r\nThe above commit has such features. \r\n\r\nIt adds 2 new data members CryptoProvider and Map<String, Object>, CryptoProvider being the flexible interface that provides sign() and verify() functions for the token and the map being the extra parameters that are required to do so (The provider might require some sort of identifier or a different algorithm / parameters to sign and verify).\r\n\r\nNow one can pass the cryptoProvider using setCryptoProvider() and the config as setConfigParams(), also added in the DefaultJwtParser/Builder interfaces.\r\n\r\nThe user defined Crypto function need to implement the added CryptoProvider interface and pass an instance of that to the Jwts builder / parser. The parsing and error checking of the config map is left to the implementation of CryptoProvider as it is completely implementation / use case specific.\r\n\r\nThe original specs of the project are not violated in any way. Only if the cryptoProvider is set, the flow moves to the custom implementation, otherwise it will continue the default implementation, So completely backwards compatible (all tests are passing)."},"comment":{"url":"https://api.github.com/repos/jwtk/jjwt/issues/comments/265072886","html_url":"https://github.com/jwtk/jjwt/pull/194#issuecomment-265072886","issue_url":"https://api.github.com/repos/jwtk/jjwt/issues/194","id":265072886,"user":{"login":"prateeknischal","id":5807820,"avatar_url":"https://avatars.githubusercontent.com/u/5807820?v=3","gravatar_id":"","url":"https://api.github.com/users/prateeknischal","html_url":"https://github.com/prateeknischal","followers_url":"https://api.github.com/users/prateeknischal/followers","following_url":"https://api.github.com/users/prateeknischal/following{/other_user}","gists_url":"https://api.github.com/users/prateeknischal/gists{/gist_id}","starred_url":"https://api.github.com/users/prateeknischal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateeknischal/subscriptions","organizations_url":"https://api.github.com/users/prateeknischal/orgs","repos_url":"https://api.github.com/users/prateeknischal/repos","events_url":"https://api.github.com/users/prateeknischal/events{/privacy}","received_events_url":"https://api.github.com/users/prateeknischal/received_events","type":"User","site_admin":false},"created_at":"2016-12-06T06:35:54Z","updated_at":"2016-12-06T06:35:54Z","body":"The the current design and code in parse/build would have to be changed, right? "}}
{"actor":{"display_login":"prateeknischal"}}