(auth_object, temp_folder, process_invoker: ProcessInvoker)
| 200 | |
| 201 | |
| 202 | def create_authenticator(auth_object, temp_folder, process_invoker: ProcessInvoker): |
| 203 | auth_type = auth_object.get('type') |
| 204 | |
| 205 | if not auth_type: |
| 206 | raise Exception('Auth type should be specified') |
| 207 | |
| 208 | auth_type = auth_type.strip().lower() |
| 209 | if auth_type == 'ldap': |
| 210 | from auth.auth_ldap import LdapAuthenticator |
| 211 | authenticator = LdapAuthenticator(auth_object, temp_folder) |
| 212 | elif auth_type == 'google_oauth': |
| 213 | from auth.auth_google_oauth import GoogleOauthAuthenticator |
| 214 | authenticator = GoogleOauthAuthenticator(auth_object) |
| 215 | elif auth_type == 'gitlab': |
| 216 | from auth.auth_gitlab import GitlabOAuthAuthenticator |
| 217 | authenticator = GitlabOAuthAuthenticator(auth_object) |
| 218 | elif auth_type == 'keycloak_openid': |
| 219 | from auth.auth_keycloak_openid import KeycloakOpenidAuthenticator |
| 220 | authenticator = KeycloakOpenidAuthenticator(auth_object) |
| 221 | elif auth_type == 'htpasswd': |
| 222 | from auth.auth_htpasswd import HtpasswdAuthenticator |
| 223 | authenticator = HtpasswdAuthenticator(auth_object, process_invoker) |
| 224 | else: |
| 225 | raise Exception(auth_type + ' auth is not supported') |
| 226 | |
| 227 | authenticator.auth_expiration_days = float(auth_object.get('expiration_days', 30)) |
| 228 | |
| 229 | authenticator.auth_type = auth_type |
| 230 | |
| 231 | return authenticator |
| 232 | |
| 233 | |
| 234 | def _prepare_allowed_users(allowed_users, admin_users, user_groups): |
no test coverage detected