Skip to content

Commit a929d3a

Browse files
authored
support optional parameters in LdapIdentityProvider (#1528)
Signed-off-by: Jeeva Kandasamy <jkandasa@gmail.com>
1 parent cbac53b commit a929d3a

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

minio/credentials/providers.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -556,19 +556,29 @@ class LdapIdentityProvider(Provider):
556556

557557
def __init__(
558558
self,
559+
*,
559560
sts_endpoint: str,
560561
ldap_username: str,
561562
ldap_password: str,
563+
duration_seconds: Optional[int] = None,
564+
policy: Optional[str] = None,
565+
token_revoke_type: Optional[str] = None,
562566
http_client: Optional[PoolManager] = None,
563567
):
564-
self._sts_endpoint = sts_endpoint + "?" + urlencode(
565-
{
566-
"Action": "AssumeRoleWithLDAPIdentity",
567-
"Version": "2011-06-15",
568-
"LDAPUsername": ldap_username,
569-
"LDAPPassword": ldap_password,
570-
},
571-
)
568+
query_params = {
569+
"Action": "AssumeRoleWithLDAPIdentity",
570+
"Version": "2011-06-15",
571+
"LDAPUsername": ldap_username,
572+
"LDAPPassword": ldap_password,
573+
}
574+
if duration_seconds:
575+
query_params["DurationSeconds"] = str(duration_seconds)
576+
if policy:
577+
query_params["Policy"] = policy
578+
if token_revoke_type:
579+
query_params["TokenRevokeType"] = token_revoke_type
580+
581+
self._sts_endpoint = sts_endpoint + "?" + urlencode(query_params)
572582
self._http_client = http_client or PoolManager(
573583
retries=Retry(
574584
total=5,

0 commit comments

Comments
 (0)