-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature[PAM]: Revoke token functionality
- Loading branch information
Showing
18 changed files
with
324 additions
and
177 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 was deleted.
Oops, something went wrong.
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,43 @@ | ||
from pubnub.enums import PNOperationType, HttpMethod | ||
from pubnub.endpoints.endpoint import Endpoint | ||
from pubnub.models.consumer.v3.access_manager import PNRevokeTokenResult | ||
from pubnub import utils | ||
|
||
|
||
class RevokeToken(Endpoint): | ||
REVOKE_TOKEN_PATH = "/v3/pam/%s/grant/%s" | ||
|
||
def __init__(self, pubnub, token): | ||
Endpoint.__init__(self, pubnub) | ||
self.token = token | ||
|
||
def validate_params(self): | ||
self.validate_subscribe_key() | ||
self.validate_secret_key() | ||
|
||
def create_response(self, envelope): | ||
return PNRevokeTokenResult(envelope) | ||
|
||
def is_auth_required(self): | ||
return False | ||
|
||
def request_timeout(self): | ||
return self.pubnub.config.non_subscribe_request_timeout | ||
|
||
def connect_timeout(self): | ||
return self.pubnub.config.connect_timeout | ||
|
||
def http_method(self): | ||
return HttpMethod.DELETE | ||
|
||
def custom_params(self): | ||
return {} | ||
|
||
def build_path(self): | ||
return RevokeToken.REVOKE_TOKEN_PATH % (self.pubnub.config.subscribe_key, utils.url_encode(self.token)) | ||
|
||
def operation_type(self): | ||
return PNOperationType.PNAccessManagerRevokeToken | ||
|
||
def name(self): | ||
return "RevokeToken" |
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
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
Oops, something went wrong.