-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2eefbd8
commit a83d83c
Showing
8 changed files
with
399 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from indykite_sdk.indykite.identity.v1beta2 import identity_management_api_pb2 as pb2 | ||
|
||
|
||
def create_consent(self, pii_processor_id, pii_principal_id, properties=[]): | ||
|
||
try: | ||
response = self.stub.CreateConsent( | ||
pb2.CreateConsentRequest( | ||
pii_processor_id=pii_processor_id, | ||
pii_principal_id=pii_principal_id, | ||
properties=properties | ||
) | ||
) | ||
except Exception as exception: | ||
print(exception) | ||
return None | ||
|
||
if not response: | ||
return None | ||
|
||
return response | ||
|
||
|
||
def list_consents(self, pii_principal_id): | ||
|
||
try: | ||
streams = self.stub.ListConsents( | ||
pb2.ListConsentsRequest( | ||
pii_principal_id=pii_principal_id | ||
) | ||
) | ||
except Exception as exception: | ||
print(exception) | ||
return None | ||
|
||
if not streams: | ||
return None | ||
|
||
responses = [] | ||
try: | ||
for response in streams: | ||
responses.append(response) | ||
except Exception as exception: | ||
print(exception) | ||
return None | ||
|
||
return responses | ||
|
||
|
||
def revoke_consent(self, pii_principal_id, consent_ids=[]): | ||
|
||
try: | ||
response = self.stub.RevokeConsent( | ||
pb2.RevokeConsentRequest( | ||
pii_principal_id=pii_principal_id, consent_ids=consent_ids | ||
) | ||
) | ||
except Exception as exception: | ||
print(exception) | ||
return None | ||
|
||
if not response: | ||
return None | ||
|
||
return response | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
from indykite_sdk.utils import timestamp_to_date | ||
from google.protobuf.json_format import MessageToDict | ||
|
||
|
||
class PiiProcessor: | ||
def __init__(self, pii_processor_id, display_name): | ||
self.pii_processor_id = pii_processor_id | ||
self.display_name = display_name | ||
self.description = None | ||
self.owner = None | ||
self.policy_uri = None | ||
self.terms_of_service_uri = None | ||
self.client_uri = None | ||
self.logo_uri = None | ||
self.user_support_email_address = None | ||
self.additional_contacts = None | ||
|
||
|
||
class PiiController: | ||
def __init__(self, pii_controller_id, display_name): | ||
self.pii_controller_id = pii_controller_id | ||
self.display_name = display_name | ||
|
||
|
||
class ConsentReceipt: | ||
def __init__(self, pii_principal_id, pii_processor): | ||
self.pii_principal_id = pii_principal_id | ||
self.pii_processor = pii_processor | ||
self.items = None | ||
|
||
|
||
class Item: | ||
def __init__(self, consent_id, pii_controller, consented_at_time, properties): | ||
self.consent_id = consent_id | ||
self.pii_controller = pii_controller | ||
self.consented_at_time = consented_at_time | ||
self.properties = properties | ||
|
||
|
||
class CreateConsentRequest: | ||
def __init__(self, pii_processor_id, pii_principal_id, properties): | ||
self.pii_processor_id = pii_processor_id | ||
self.pii_principal_id = pii_principal_id | ||
self.properties = properties | ||
|
||
|
||
class CreateConsentResponse: | ||
def deserialize(cls, message): | ||
if message is None: | ||
return None | ||
|
||
create_consent = CreateConsentResponse( | ||
str(message.consentId), | ||
) | ||
|
||
return create_consent | ||
|
||
def __init__(self, consent_id): | ||
self.consent_id = consent_id | ||
|
||
|
||
class ConsentApproval: | ||
def __init__(self, grant_scopes, granted_audiences, session, remember, remember_for): | ||
self.grant_scopes = grant_scopes | ||
self.granted_audiences = granted_audiences | ||
self.session = session | ||
self.remember = remember | ||
self.remember_for = remember_for | ||
|
||
|
||
class ConsentRequestSessionData: | ||
def __init__(self, access_token, id_token, userinfo): | ||
self.access_token = access_token | ||
self.id_token = id_token | ||
self.userinfo = userinfo | ||
|
Oops, something went wrong.