4 from . import auth_event
6 def pam_sm_authenticate(pamh, flags, argv):
8 config['arvados_api_host'] = argv[1]
9 config['virtual_machine_hostname'] = argv[2]
15 username = pamh.get_user(None)
16 except pamh.exception, e:
20 return pamh.PAM_USER_UNKNOWN
23 prompt = '' if config.get('noprompt') else 'Arvados API token: '
24 token = pamh.conversation(pamh.Message(pamh.PAM_PROMPT_ECHO_OFF, prompt)).resp
25 except pamh.exception as e:
28 if auth_event.AuthEvent(
31 client_host=pamh.rhost,
33 token=token).can_login():
34 return pamh.PAM_SUCCESS
36 return pamh.PAM_AUTH_ERR
38 def pam_sm_setcred(pamh, flags, argv):
39 return pamh.PAM_SUCCESS
41 def pam_sm_acct_mgmt(pamh, flags, argv):
42 return pamh.PAM_SUCCESS
44 def pam_sm_open_session(pamh, flags, argv):
45 return pamh.PAM_SUCCESS
47 def pam_sm_close_session(pamh, flags, argv):
48 return pamh.PAM_SUCCESS
50 def pam_sm_chauthtok(pamh, flags, argv):
51 return pamh.PAM_SUCCESS