Skip to content

SSO - #431

Open
jicampos wants to merge 3 commits into
developfrom
jcampos/SSO
Open

SSO#431
jicampos wants to merge 3 commits into
developfrom
jcampos/SSO

Conversation

@jicampos

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings July 31, 2026 17:11

Copilot AI 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.

Pull request overview

This PR introduces initial Single Sign-On (SSO) support using an OpenID Connect (OIDC) authorization-code flow in GatewaySupervisor, along with related WebUsers utilities updates and a small robustness improvement to the tools/ots launcher.

Changes:

  • Add OIDC login and callback endpoints in GatewaySupervisor (including config parsing and token exchange via libcurl).
  • Extend WebUsers to support creating/activating sessions based on externally authenticated email identities.
  • Add a relaunch-attempt limit to the gateway-context launch loop in tools/ots.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/ots Adds a bounded retry loop when gateway context launch can’t be verified.
otsdaq/WebUsersUtilities/WebUsers.h Extends the WebUsers API to support email-based SSO session activation and configurable initial permissions on account creation.
otsdaq/WebUsersUtilities/WebUsers.cc Implements email-based session activation and initial-permission support for new accounts.
otsdaq/GatewaySupervisor/GatewaySupervisor.h Adds XGI handlers for OIDC login and callback endpoints.
otsdaq/GatewaySupervisor/GatewaySupervisor.cc Implements OIDC discovery, authorization redirect, code exchange, and session activation glue.
otsdaq/GatewaySupervisor/CMakeLists.txt Links GatewaySupervisor against libcurl for OIDC HTTP requests.
Suppressed comments (2)

otsdaq/GatewaySupervisor/GatewaySupervisor.cc:10889

  • The callback trusts the decoded id_token payload without validating the JWT signature or required OIDC claims (at least iss, aud, and exp). Without token validation, a forged/replayed token could be accepted as a login identity.
	// decode the ID token claims and extract the user's identity
	std::string claims = oidcJwtPayload(idToken);
	if(claims == "")
	{
		oidcErrorPage(out, "Could not decode ID token");

otsdaq/WebUsersUtilities/WebUsers.cc:1661

  • Auto-created SSO accounts are currently granted PERMISSION_LEVEL_EXPERT (100), even though the comment above says they should be created with novice permissions. This grants elevated privileges to any authenticated SSO user.
			createNewAccount(newUsername,
			                 newDisplayName,
			                 email,
			                 WebUsers::PERMISSION_LEVEL_EXPERT /*initial permission (100)*/);

Comment on lines 1132 to +1136
// first user is admin always!
std::map<std::string /*groupName*/, WebUsers::permissionLevel_t> initPermissions = {
{WebUsers::DEFAULT_USER_GROUP,
(Users_.size() ? WebUsers::PERMISSION_LEVEL_NOVICE
: WebUsers::PERMISSION_LEVEL_ADMIN)}};
(Users_.size() ? initialPermission
: WebUsers::permissionLevel_t(WebUsers::PERMISSION_LEVEL_ADMIN))}};
Comment on lines +1625 to +1627
for(const char& c : email.substr(0, email.find('@')))
if(isalnum(c) || c == '_' || c == '-' || c == '.')
baseUsername += c;
Comment on lines +10652 to +10659
std::string oidcGenRandomHex(unsigned int length)
{
static const char hex[] = "0123456789abcdef";
std::string out;
for(unsigned int i = 0; i < length; ++i)
out += hex[rand() % 16];
return out;
} // end oidcGenRandomHex()
Comment on lines +10679 to +10684
if((unsigned char)c < 0x20)
{
char buf[8];
snprintf(buf, sizeof(buf), "\\u%04x", c);
out += buf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋 Triage

Development

Successfully merging this pull request may close these issues.

3 participants