Skip to content
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

Updating API to separate session handling from GetAuthenticationModes #7

Merged
merged 7 commits into from
Aug 1, 2023

Conversation

denisonbarbosa
Copy link
Member

We used to start a new session and already return the supported authentication modes when the user selected a broker to use for authentication. In order to support MFA, we need to be able to call GetAuthenticationModes multiple times per session, which is not compatible with the way its currently implemented.

This PR splits SelectBroker into two different methods:

  • SelectBroker, which starts a new session for the specified user and associates a broker to the created session;
  • GetAuthenticationModes, which fetches a list of supported authentication modes that are available for the given session;

UDENG-1125

@denisonbarbosa denisonbarbosa requested a review from a team as a code owner July 31, 2023 16:22
Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

Just a couple of minor issues (comments + mutex missing if I am correct), and then, good to merge!

internal/brokers/examplebroker.go Outdated Show resolved Hide resolved
internal/brokers/manager.go Outdated Show resolved Hide resolved
Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

that + missing updates

internal/brokers/examplebroker.go Outdated Show resolved Hide resolved
internal/brokers/examplebroker.go Show resolved Hide resolved
Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to merge!

This change is to keep the naming aligned with the specification
We updated the API to separate the GetAuthenticationModes call from
session handling, since (in order to support MFA) we need GAM to be
called multiple times per session.
Since those are no-op, it's best to separate the diff from the broker
that actually matters (for now).
We were not locking the mutexes when reading from the maps and this
could result in races as well.

Now we also check if the session still exists before modifying the map,
otherwise we would just recreate it accidentaly

Some variables were renamed for more consistency between the functions
and their meaning
@denisonbarbosa denisonbarbosa merged commit 98e65ec into main Aug 1, 2023
2 of 3 checks passed
@denisonbarbosa denisonbarbosa deleted the update-api branch August 1, 2023 12:25
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