Skip to content

feat: Moved IDP response and template behaviour to single class - #876

Merged
jvherweg merged 1 commit into
mainfrom
feat/idp-architecture
Aug 2, 2021
Merged

jvherweg merged 1 commit into
mainfrom
feat/idp-architecture

Conversation

@jvherweg

Copy link
Copy Markdown
Member

Partial solution for #722 .

Have been dragging this branch along for a while, finally got it at a point I'm sort of happy with it. :D

This is quite a big change to the IDP although none of the behaviour actually changes.

Might be too much for 1.0.0 (since I'm guessing this one might require some back and forth).

What it does

All the IDP handlers (InteractionHandlers) no longer write to the Response object themselves. Currently they still receive the Response object since 1 of them needs it for a call to the OIDC library.

Behaviour that redirects initial request based on prompt was moved to IdentityProviderHttpHandler (from InitialInteractionHandler).

Behaviour that shows templates on GET and handles interactions on POST now also moved to IdentityProviderHttpHandler (from IdpRouteController).

Because of the above, the IdentityProviderHttpHandler is now the only class aware of all URL and template paths relevant for the IDP.

This might be too much for 1 class? Could move the second part back to the individual IdpRouteControllers. Also will depend a bit on the things that still should be done, see below

Things I still want to do

All things mentioned here would be done in separate PRs. This PR already stands on it own without them.

Find a way to no longer have to send the Response object along. I'm not even sure why the OIDC library needs it since the function in question gives information about the Request. Could handle the one class that needs this completely separately since this is also going to be an issue once we remove the Request parameter.

Remove the Request paramater. Specifically: have a body parser/URL extractor in the IdentityProviderHttpHandler, similarly to the IDP handler. We could even use the same one, although we probably don't want to pass Representation objects to the handlers since we'll always have JSON-like objects.

Remove the TemplateHandler and instead make use of the same ResponseWriter as the LDP handler. This should just require a layer inbetween that converts the handler output to the valid input for the ResponseWriter.

Support JSON output besides HTML output.

Go through the IDP issues now that they should be easier to fix.

@jvherweg
jvherweg requested a review from RubenVerborgh July 29, 2021 14:44

@RubenVerborgh RubenVerborgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Absolutely great!

"@type": "TemplateHandler",
"templateEngine": { "@type": "EjsTemplateEngine" }
},
"interactionCompleter": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At this point I'm wondering what a completer is. Comment?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Going to add a comment, but just in case you were wondering: this sends the request back to the OIDC library with the extra metadata we added (specifically: log in in with the given WebID) and then tell it to continue doing its OIDC magic handshake thingy.

@jvherweg
jvherweg force-pushed the feat/idp-architecture branch from 98ba20e to 7cfa1f9 Compare August 2, 2021 09:04
@jvherweg
jvherweg merged commit 9d337ba into main Aug 2, 2021
@jvherweg
jvherweg deleted the feat/idp-architecture branch August 2, 2021 09:29
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