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

Add support of multi oidcIssuer relations per one user's profile #30

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

smalinin
Copy link
Contributor

@smalinin smalinin commented Sep 4, 2018

No description provided.

@kidehen
Copy link

kidehen commented Oct 4, 2018

@kjetilk @RubenVerborgh ,

What's happening with this PR?

/cc @justinwb

@RubenVerborgh RubenVerborgh self-requested a review October 4, 2018 17:57
Copy link
Contributor

@RubenVerborgh RubenVerborgh left a comment

Choose a reason for hiding this comment

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

Agree with the added functionality but disagree with the implementation.

The "discover all" functionality is not what we need. We simply want to validate whether a given party is allowed to act as an issuer for a given user. So rather than a discovery method, we need a validation method. At no point do we need a list of all possible providers.

// drop the path (provider origin only)
if (providerUri) {
providerUri = (new URL(providerUri)).origin
if (Array.isArray(providerUri)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not good; should always be an array.

Copy link
Contributor

@megoth megoth Oct 10, 2018

Choose a reason for hiding this comment

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

Could force it into an array with [].concat(providerUri) (if there are possible cases where it's not - which I guess shouldn't be in this case; nevertheless, it's a nice "hack" to know of)

@@ -61,20 +61,48 @@ function providerExists (uri) {
* given Web ID, extracted from Link rel header or profile body. If no
* provider URI was found, reject with an error.
*/
function discoverProviderFor (webId) {
function discoverProviderFor (webId, issuer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So the method functionality has changed from discovering to validating? We probably need a method like isValidProvider then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will update the code.
I tried to create fix with a minimal changes in the code.

} else {
validateProviderUri(null, webId) // Throw an error if empty or invalid
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

The above logic is very messy.

@@ -94,16 +122,30 @@ function discoverFromHeaders (webId) {
})
}

function discoverFromProfile (webId) {
function discoverAllFromProfile (webId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should then also become validateFromProfile and accept a second issuer parameter. Will eliminate most of the messy logic above.

Base automatically changed from master to main February 24, 2021 18:39
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.

4 participants