Skip to content

Ability to log in with HarvardKey from discovery page.#16

Open
rute-santos wants to merge 4 commits into
mainfrom
harvard-key
Open

Ability to log in with HarvardKey from discovery page.#16
rute-santos wants to merge 4 commits into
mainfrom
harvard-key

Conversation

@rute-santos

Copy link
Copy Markdown
Contributor

No description provided.

@rute-santos rute-santos requested a review from gabeabrams July 15, 2025 20:23
Comment thread src/Kaixa.groovy
Comment thread src/Kaixa.groovy Outdated
Comment thread src/Kaixa.groovy Outdated
Comment thread src/Kaixa.groovy
Kaixa.click('.btn-primary');
boolean isHarvardKey = obj.has('isHarvardKey') && obj.getBoolean('isHarvardKey');
boolean needs2FA = isHarvardKey && obj.has('needs2FA') && obj.getBoolean('needs2FA');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In GlobalCredentials, the user will be something like:

	public static String admin ='''
		{
		   'username': 'my_name@harvard.edu',
		   'password': '',
           'isHarvardKey': true,
           'needs2FA': true,
		}

I'm not attached to specific names so please suggest better ones.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this. The only thing I'm thinking is that the name isHarvardKey is confusing to me because isn't Harvard Guest part of HarvardKey? Maybe clearer would be to flip this and just call it isHarvardGuest? Or something like isOfficialHarvardKey or something

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flipping it to isHarvardGuest is good with me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now:
public static String admin ='''
{
'username': 'guest_name@outlook.com',
'password': 'blah',
'isHarvardGuest': true,
}

Comment thread src/Kaixa.groovy Outdated
* page for the user to choose between HarvardKey and Harvard Guest credentials
*/
public static void handleHarvardKey(name) {
public static void handleHarvardKey(String name, boolean expectDiscoveryPage = true) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not detect whether there is a discovery page?

@rute-santos rute-santos Aug 22, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... When I implemented this, I was thinking that it's part of the test: if the application is expecting the discovery page and there isn't one, the test would fail. But: we are not testing the Harvard login, right? So I guess it's fine. It certainly will make things simpler.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread src/Kaixa.groovy Outdated
Kaixa.waitForAtLeastOneElementPresent([
'#idp_1001962798_button', // HarvardGuest
'#idp_1824601020_button', // HarvardKey
]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be the feature you could use to check if there's a discovery page. This function returns which one appeared. You could wait for either the discovery page or the login page and handle it appropriately

@gabeabrams gabeabrams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good! Just a couple thoughts, but nothing blocking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants