generated from cyberark/conjur-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from cyberark/auth-strategry-refactor
Abstract authentication flow into new interface
- Loading branch information
Showing
14 changed files
with
229 additions
and
95 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
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,30 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
AuthenticationStrategy Interface | ||
This class describes a shared interface for authenticating to Conjur | ||
""" | ||
|
||
# Builtins | ||
import abc | ||
from conjur_api.models.general.conjur_connection_info import ConjurConnectionInfo | ||
from conjur_api.models.ssl.ssl_verification_metadata import SslVerificationMetadata | ||
|
||
# pylint: disable=too-few-public-methods | ||
class AuthenticationStrategyInterface(metaclass=abc.ABCMeta): # pragma: no cover | ||
""" | ||
AuthenticationStrategyInterface | ||
This class is an interface that outlines a shared interface for authentication strategies | ||
""" | ||
|
||
@abc.abstractmethod | ||
async def authenticate( | ||
self, | ||
connection_info: ConjurConnectionInfo, | ||
ssl_verification_data: SslVerificationMetadata | ||
) -> str: | ||
""" | ||
Authenticate uses the api_key to fetch a short-lived conjur_api token that | ||
for a limited time will allow you to interact fully with the Conjur | ||
vault. | ||
""" |
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,21 @@ | ||
""" | ||
AuthnTypes module | ||
This module is used to represent different authentication methods. | ||
""" | ||
|
||
from enum import Enum | ||
|
||
|
||
class AuthnTypes(Enum): # pragma: no cover | ||
""" | ||
Represent possible authn methods that can be used. | ||
""" | ||
AUTHN = 0 | ||
# Future: | ||
# LDAP = 1 | ||
|
||
def __str__(self): | ||
""" | ||
Return string representation of AuthnTypes. | ||
""" | ||
return self.name.lower() |
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.