virgil_sdk.jwt package¶
Submodules¶
virgil_sdk.jwt.jwt module¶
-
class
virgil_sdk.jwt.jwt.
Jwt
(jwt_header_content=None, jwt_body_content=None, signature_data=None)[source]¶ Bases:
virgil_sdk.jwt.abstractions.access_token.AccessToken
The Jwt class implements abstract AccessToken in terms of Virgil JWT.
-
classmethod
from_string
(jwt_string)[source]¶ Initializes a new instance of the Jwt class using its string representation.
Parameters: jwt_string – String representation of signed jwt. It must be equal to: base64UrlEncode(JWT Header) + “.” + base64UrlEncode(JWT Body) “.” + base64UrlEncode(Jwt Signature). Returns: Initialized instance of Jwt. Raises: ValueError
– Wrong jwt format.
-
identity
¶ Jwt identity.
-
signature_data
¶ Gets a digital signature of jwt.
-
unsigned_data
¶ String representation of jwt without signature. It equals to: base64UrlEncode(JWT Header) + “.” + base64UrlEncode(JWT Body)
-
classmethod
virgil_sdk.jwt.jwt_body_content module¶
-
class
virgil_sdk.jwt.jwt_body_content.
JwtBodyContent
(app_id, identity, issued_at, expires_at, data)[source]¶ Bases:
object
JwtBodyContent represents content of Jwt.
-
expires_at
¶ When jwt expire.
-
classmethod
from_json
(json_loaded_dict)[source]¶ Initializes a new instance of the JwtBodyContent from json representation.
-
identity
¶ Jwt identity.
-
identity_prefix
¶
-
issuer
¶ Jwt issuer.
-
json
¶ JwtBodyContent json representation.
-
subject_prefix
¶
-
virgil_sdk.jwt.jwt_generator module¶
-
class
virgil_sdk.jwt.jwt_generator.
JwtGenerator
(app_id, api_key, api_public_key_id, lifetime, access_token_signer)[source]¶ Bases:
object
The JwtGenerator class implements Jwt generation.
Parameters: - app_id – Application id. Take it on https://dashboard.virgilsecurity.com
- api_key – Private Key which will be used for signing generated access tokens. Take it on https://dashboard.virgilsecurity.com/api-keys
- api_public_key_id – Key Id of take it on https://dashboard.virgilsecurity.com/api-keys
- lifetime – Lifetime of generated tokens.
- access_token_signer – An instance of AccessTokenSigner that is used to generate token signature using api_key.
virgil_sdk.jwt.jwt_header_content module¶
-
class
virgil_sdk.jwt.jwt_header_content.
JwtHeaderContent
(algorithm, key_id, access_token_type='JWT', content_type='virgil-jwt;v=1')[source]¶ Bases:
object
JwtHeaderContent represents header of Jwt
-
ACCESS_TOKEN_TYPE
= 'JWT'¶
-
CONTENT_TYPE
= 'virgil-jwt;v=1'¶
-
access_token_type
¶ Access token type.
-
algorithm
¶ Signature algorithm.
-
content_type
¶ Access token content type.
-
classmethod
from_json
(json_loaded_dict)[source]¶ Initializes a new instance of the JwtHeaderContent from json representation.
Parameters: json_loaded_dict – JwtHeaderContent json representation Returns: A new instance of JwtHeaderContent.
-
json
¶ JwtHeaderContent json representation.
-
key_id
¶ Id of public key which is used for jwt signature verification.
-
virgil_sdk.jwt.jwt_verifier module¶
virgil_sdk.jwt.token_context module¶
-
class
virgil_sdk.jwt.token_context.
TokenContext
(identity, operation, force_reload=False, service=None)[source]¶ Bases:
object
TokenContext provides payload for CallbackJwtProvider.get_token(TokenContext)
-
force_reload
¶ You can set up token cache in CachingCallbackProvider.get_token and reset cached token if True.
-
identity
¶ Identity that should be used in access token.
-
operation
¶ Operation for which token is needed.
-
service
¶ Service for which token is needed.
-