Add ESIA (esia.gosuslugi.ru) API draft #1014
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added ESIA (esia.gosuslugi.ru) API draft.
Currently only getting authorization code and trading it for access token (with OpenID JWT token) is implemented. Implementation can be tested using EsiaExample.
To access ESIA OAuth API, your client should be registered and approved by authorities as described in https://digital.gov.ru/ru/documents/4244. Also you should upload a valid X.509 certificate with GOST 2012 algorithm to your client's account in sandbox (and then production) ESIA tech portal. This certificate will be used by ESIA to authenticate your requests (ESIA uses its own client authentication scheme described in https://digital.gov.ru/ru/documents/6186). Sandbox environment allows use of self-signed certificates.
Signing requests with GOST 2012 algorithm is implemented using BouncyCastle 1.65 opensource crуptoprovider (and you may build your own implementation). Prior BC versions fail reading tricky private keys created by CryptoPro tool. To use provided implementation you should have both certificate and private key in PEM format (not in single file as BC cannot read it).