Skip to content

Add identity provider - #455

Merged
jvherweg merged 125 commits into
mainfrom
feat/identity-provider-refactor
May 4, 2021
Merged

jvherweg merged 125 commits into
mainfrom
feat/identity-provider-refactor

Conversation

@jaxoncreed

@jaxoncreed jaxoncreed commented Jan 1, 2021 •

Copy link
Copy Markdown
Contributor

@jaxoncreed
jaxoncreed marked this pull request as draft January 1, 2021 16:01
@matthieubosquet
matthieubosquet force-pushed the feat/identity-provider-refactor branch from f4d52ff to cbe3c27 Compare January 4, 2021 23:26
@RubenVerborgh
RubenVerborgh force-pushed the master branch 2 times, most recently from 513d754 to 27a5711 Compare January 8, 2021 23:26
@matthieubosquet
matthieubosquet force-pushed the feat/identity-provider-refactor branch from 011c0e5 to 35beff2 Compare January 12, 2021 11:07

@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.

Hi, here's my first batch of comments.

Importantly, all classes and interfaces will need TSdoc; we need to understand what every class does.

Comment thread config/presets/cli-params.json Resolved
Comment thread src/server/util/RenderEjsHandler.ts Resolved
Comment thread src/server/util/RouterHandler.ts Resolved
Base automatically changed from master to main February 3, 2021 08:09
@RubenVerborgh RubenVerborgh changed the title Feat/identity provider refactor Add identity provider Feb 22, 2021

@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.

Various comments, structurally mainly:

  • do we need all the factories?
  • do we need GET and POST handlers, or can we just have everything as a controller?

Comment thread src/identity/IdentityProviderFactory.ts Resolved
Comment thread src/identity/storage/KeyValueStore.ts Outdated
* A simple key value interface that's used in non-LDP related
* storage classes
*/
export interface KeyValueStore {

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.

Note: we have such a store now, I believe. @joachimvh?

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.

I think @joachimvh wanted to replace that, so I'll leave this task to him.

/**
* A KeyValueStore that wraps a provided ResourceStore
*/
export class PassthroughKeyValueStore implements KeyValueStore {

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.

Suggested change
export class PassthroughKeyValueStore implements KeyValueStore {
export class KeyValueResourceStore implements KeyValueStore {

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.

Again, I disagree. This is not a ResourceStore. It's a Key Value Store. Calling it a ResourceStore is false advertising.

* An IdP storage adapter that uses a ResourceStore
* to persist data.
*/
export class ResourceStoreStorageAdapter implements Adapter {

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.

Suggested change
export class ResourceStoreStorageAdapter implements Adapter {
export class IdpResourceStore implements Adapter {

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.

Again, I disagree. This is not a ResourceStore. It's a storage adapter. Calling it a ResourceStore is false advertising.

Comment thread src/server/util/GetPostRouterHandler.ts Outdated
Comment on lines +11 to +12
private readonly getHandler: HttpHandler;
private readonly postHandler: HttpHandler;

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.

Shall we just make this an abstract class, where handleGet and handlePost are methods?

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.

Ah, but RenderEjsHandler below might prove me wrong then. Or maybe not; this can just be a helper function then.

@ianconsolata ianconsolata mentioned this pull request Feb 22, 2021
@jvherweg
jvherweg force-pushed the feat/identity-provider-refactor branch from 0d38a17 to e71b5b6 Compare March 8, 2021 10:04
@jvherweg
jvherweg force-pushed the feat/identity-provider-refactor branch 3 times, most recently from 9d34ab3 to 0e2bf08 Compare March 31, 2021 13:24
@jvherweg

Copy link
Copy Markdown
Member

Updated the CI to also run for PRs going into this branch (I think). Should remove that part before merging into main.

The CI now succeeds on this branch. This did require some changes though:

  • --ignore-scripts had to be removed from the npm ci calls since bcrypt needs a script to run when installing.
  • 14.0 had to be removed since for some reason the openid-client used in solid-client-authn does not receive a body when accessing /.well-known/openid-configuration. It works in the browser though so there is probably an issue with 14.0 there.
  • 15.0 had to be removed since there's an issue with the npm version that gets installed along with it causing the post-install scripts not to run. This means the build script would not run after running npm ci.
  • 15.x required the change in eeda094 to work.

15.0 could be added by still running the build script after running npm ci (this would cause all other versions to build twice though, but since there is a cache this might not be much of an issue.

I don't think there's an easy fix to still support 14.0 in the CI though. We actually do support that version as everything still works in the browser, it's just the node version of the solid-client-authn used in the integration returns wrong results in 14.0 so probably the result of an edge case bug in 14.0. We could ignore this integration test in this version or the .0 perhaps but that would set the door open for different exceptions per version. We could also look for the first 14.x version that does work and use that instead.

@RubenVerborgh

Copy link
Copy Markdown
Member
* 14.0 had to be removed

That's acceptable, let's just find the minimum 14.x version that works.

jaxoncreed and others added 12 commits April 6, 2021 09:28
* Logs in with solid oidc

* Refactored Provider

* Attempt to hook up dependencies

* Partial wiring of oidc provider components

* IdP networking now works with architecture

* Interaction Handlers Set Up

* fix: Rename & adapt to CSS

* Included Login Interaction

* Refactored architecture to bind Interaction Policy to HttpHandlers

Co-authored-by: Matthieu Bosquet <[email protected]>
@jvherweg
jvherweg force-pushed the feat/identity-provider-refactor branch from 7e976a7 to 895cbde Compare April 6, 2021 07:43
@jvherweg
jvherweg force-pushed the feat/identity-provider-refactor branch from 010607a to bad8bc8 Compare April 27, 2021 13:32
@jvherweg
jvherweg requested a review from RubenVerborgh April 27, 2021 13:46
@jvherweg
jvherweg marked this pull request as ready for review April 27, 2021 14:33

@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.

Excellent work on this major feature. Thank you all!

Comment thread .github/workflows/ci.yml Resolved
Comment thread README.md Resolved
Comment thread README.md Resolved
Comment thread config/presets/cli-params.json Resolved
@RubenVerborgh

Copy link
Copy Markdown
Member

Shall we also create issues for missing functionality like the client id?

@jvherweg

jvherweg commented May 3, 2021

Copy link
Copy Markdown
Member

Shall we also create issues for missing functionality like the client id?

Created #718. I think that's the only one still needed unless @matthieubosquet knows of some more.

"@graph": [
{
"comment": "This value can be used to set up an actual e-mail client",
"comment": "The default configuration does not contain credentials for an email client. In production systems, you likely want to set up your own.",

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.

I'm assuming this will not result in a crash? So it will just log an error that the email cannot be sent? Or will it crash?

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.

Somewhere in between. It will throw an error, but the only time this is used is on the "forgot password" page, of which the handler already catches all errors. So this will result in an error being displayed on that page when the submit button is pressed.

@RubenVerborgh

Copy link
Copy Markdown
Member

Are all of the templates injection-proof? That is, if I inject <script>alert(1)</script> for any variable, will the HTML be escaped?

(Whether or not the values are constrained beforehand is another matter; I just want to check that all templates will produce correct HTML regardless of the input given to them.)

@jvherweg

jvherweg commented May 4, 2021

Copy link
Copy Markdown
Member

Are all of the templates injection-proof? That is, if I inject <script>alert(1)</script> for any variable, will the HTML be escaped?

I actually had no idea so I added a unit test for that. The ejs library that is used for rendering escapes such strings.

@jvherweg
jvherweg force-pushed the feat/identity-provider-refactor branch from a2b153e to f1cc3bf Compare May 4, 2021 09:35
# Conflicts:
#	test/integration/ServerFetch.test.ts
#	test/unit/init/CliRunner.test.ts
#	test/util/TestHelpers.ts
#	test/util/Util.ts
@jvherweg

jvherweg commented May 4, 2021

Copy link
Copy Markdown
Member

All the comments above should be covered, and the branch is up to date with the main branch and all tests succeed, so as far as I'm concerned a (squash) merge should finally be possible.

@RubenVerborgh

Copy link
Copy Markdown
Member

Yeah let's go!

@jvherweg
jvherweg merged commit 1d65143 into main May 4, 2021
@jvherweg
jvherweg deleted the feat/identity-provider-refactor branch May 4, 2021 11:17
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