-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autofill credentials in the SAML window from ini file #82
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the interface here be made compatible with openconnect --form-entry=NAME:VALUE
? https://www.infradead.org/openconnect/manual.html#opt-form-entry
In particular, form fields should be specified by the name attribute rather than the id attriute.
gp_saml_gui.py
Outdated
def setvalue_DOM_element(self, selector, value): | ||
if self.wview: | ||
self.wview.evaluate_javascript("document.getElementById('" + selector + "').value='" + value + "';", -1, None, None, None, None, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need quoting. Using JSON should be sufficient, e.g. "document.getElementById(%s).value = %s;" % (json.dumps(selector), json.dumps(value));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed this one, thank you
gp_saml_gui.py
Outdated
for x in ['username', 'password']: | ||
self.credentials[x] = config['gp-saml-gui'][x] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not allow any arbitrarily-named form field to be set? (For example, what if the password field is called passwd
, what if there's an extra dropdown field called realm
that needs to be set, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not only I've added arbitrarily-named form field to be set, but also domain specific, so in the same file one can store different field-value for different domains: e.g,
[domain.one]
user=user
password=password
[domain.two]
email=email
pwd=pwd
This filling operation happens before openconnect is called. Additionally, I'm not sure if we should actually use --form-entry, as the manual suggest "This option should not be used to enter passwords. --passwd-on-stdin should be used for that purpose." I initially based that on _id_attribute because they're supposed to be unique. To conform to _name_attribute, I've also added code to fill name too! (where id is filled after name). |
This allows one to autofill credentials in the SAML window from ini file.
Default is "~/.gp-saml-gui-credentials", can be specified with "--login" command line argument.
Mode of the credential file should be set the to 600 (similarly to .git-credentials, .ssh/id_rsa, ...).