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 OIDC authentication #6534

Merged
merged 51 commits into from
Dec 5, 2022
Merged

Add OIDC authentication #6534

merged 51 commits into from
Dec 5, 2022

Conversation

frcroth
Copy link
Member

@frcroth frcroth commented Oct 5, 2022

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • Create a local OIDC provider. See the comment below. (note: if keycloak is started via docker (not compose), change application.conf to providerURL = "http://localhost:8080/realms/master/")
  • also set oidcEnabled to true in the application.conf features block
  • open http://localhost:9000/auth/login and use the "login with sso" button
  • you should be redirected to the keycloak UI
  • log in with admin:admin
  • you should be redirected to webknossos (a new account was created and you are logged in)
  • log out and log back in (e.g. with incognito tab), the same account should be logged in
  • disable oidcEnabled again and verify that the log in/out mechanism works as usual

Open questions:

  • Is client authentication required (currently not implemented)
  • Should there be an option to disable OIDC?

Issues:


(Please delete unneeded items, merge only when none are left open)

@frcroth
Copy link
Member Author

frcroth commented Oct 20, 2022

You can use keycloak. Put the following into a docker-compose.yaml and start it with docker compose up.

version: '3'

volumes:
  mysql_data:
      driver: local

services:
  mysql:
      image: mysql:5.7
      volumes:
        - mysql_data:/var/lib/mysql
      environment:
        MYSQL_ROOT_PASSWORD: root
        MYSQL_DATABASE: keycloak
        MYSQL_USER: keycloak
        MYSQL_PASSWORD: password
  keycloak:
      image: quay.io/keycloak/keycloak:legacy
      environment:
        DB_VENDOR: MYSQL
        DB_ADDR: mysql
        DB_DATABASE: keycloak
        DB_USER: keycloak
        DB_PASSWORD: password
        KEYCLOAK_USER: admin
        KEYCLOAK_PASSWORD: admin
        # Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the MySQL JDBC driver documentation in order to use it.
        #JDBC_PARAMS: "connectTimeout=30000"
      ports:
        - 8080:8080
      depends_on:
        - mysql

Then, you can import a client with this JSON into your master realm:

{
  "clientId": "myclient",
  "name": "My client",
  "description": "",
  "rootUrl": "",
  "adminUrl": "",
  "baseUrl": "http://localhost:8080/realms/master/myclient/",
  "surrogateAuthRequired": false,
  "enabled": true,
  "alwaysDisplayInConsole": false,
  "clientAuthenticatorType": "client-secret",
  "redirectUris": [
    "",
    "*",
    "http://localhost:9000/api/auth/oidc/callback",
    "https://www.keycloak.org/app/*"
  ],
  "webOrigins": [],
  "notBefore": 0,
  "bearerOnly": false,
  "consentRequired": false,
  "standardFlowEnabled": true,
  "implicitFlowEnabled": false,
  "directAccessGrantsEnabled": true,
  "serviceAccountsEnabled": false,
  "publicClient": true,
  "frontchannelLogout": true,
  "protocol": "openid-connect",
  "attributes": {
    "oidc.ciba.grant.enabled": "false",
    "display.on.consent.screen": "false",
    "oauth2.device.authorization.grant.enabled": "false",
    "backchannel.logout.session.required": "true",
    "backchannel.logout.revoke.offline.tokens": "false"
  },
  "authenticationFlowBindingOverrides": {},
  "fullScopeAllowed": true,
  "nodeReRegistrationTimeout": -1,
  "defaultClientScopes": [
    "web-origins",
    "acr",
    "roles",
    "profile",
    "email"
  ],
  "optionalClientScopes": [
    "address",
    "phone",
    "offline_access",
    "microprofile-jwt"
  ],
  "access": {
    "view": true,
    "configure": true,
    "manage": true
  }
}
  • ensure that a user with name, email and password exists in keycloak

@frcroth frcroth changed the title WIP: Add OIDC authentication Add OIDC authentication Oct 20, 2022
@frcroth frcroth requested a review from fm3 October 20, 2022 10:06
@frcroth frcroth marked this pull request as ready for review October 20, 2022 10:06
Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

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

Thanks for fighting your way through this! I think this is already going in a great direction. I added a few comments, mostly about naming (let’s avoid the abbreviation oidc), and about accessing the config.

We might want to discuss later if we want to redirect the user directly or keep the API somewhat rest-ful, and return json uris and do the redirection in the front-end but that is a change we can build later on, when a frontend is added.

app/models/user/UserService.scala Outdated Show resolved Hide resolved
app/oxalis/security/OpenIdConnectClient.scala Outdated Show resolved Hide resolved
app/oxalis/security/OpenIdConnectClient.scala Outdated Show resolved Hide resolved
app/oxalis/security/OpenIdConnectClient.scala Outdated Show resolved Hide resolved
app/utils/WkConf.scala Outdated Show resolved Hide resolved
app/controllers/AuthenticationController.scala Outdated Show resolved Hide resolved
/*
Build redirect URL to redirect to OIDC provider for auth request (https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest)
*/
def redirectUrl(openIdClient: OpenIdConnectConfig, redirectUrl: String): Fox[String] =
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def redirectUrl(openIdClient: OpenIdConnectConfig, redirectUrl: String): Fox[String] =
def getRedirectUrl: Fox[String] =

I’d add the get because redirect also reads a bit like a verb.

I’d say it is not necessary to pass the parameters in from the caller, but rather have lazy vals for the client itself, I thinkt it already has everything it needs to construct them (mostly the injected WkConf).
Maybe the OpenIdConnectConfig case class is not needed at all, but the fields can be read from the passed WkConf where needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Redirect URL as stated above should not be known to the oidcclient IMO. The oidcconfig info can also be gathered at the client, true. However, the case class can be useful IMO because it allows for checking if the configuration is valid (and thus determine if the routes are activated)

app/controllers/AuthenticationController.scala Outdated Show resolved Hide resolved
app/controllers/AuthenticationController.scala Outdated Show resolved Hide resolved
absoluteOidcCallbackURL,
request.queryString.get("code").flatMap(_.headOption).getOrElse("missing code"),
)
oidc: OpenConnectId <- validateJsValue[OpenConnectId](code).toFox
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
oidc: OpenConnectId <- validateJsValue[OpenConnectId](code).toFox
openConnectId <- validateJsValue[OpenConnectId](code).toFox

(if I understand correctly that OpenIdConnect uses OpenConnectIds? Seems confusing to me, but may be correct if that’s what the protocol states)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not something that is directly part of the protocol. I renamed it to OpenIdConnectClaimSet since it describes it more accurately

@fm3 fm3 mentioned this pull request Oct 24, 2022
7 tasks
@frcroth
Copy link
Member Author

frcroth commented Oct 25, 2022

Yes, it does not all have to be done in the backend. Typically the front end does some of the stuff in a OIDC flow. Also including refreshing authorization. I just did this so I could test it.

@frcroth
Copy link
Member Author

frcroth commented Nov 24, 2022

@frcroth what exactly is OIDC Implicit flow? I noticed that in the steps to test the client has implicitFlowEnabled: false but you named the PR this way – does that mean we are testing something else?

Yes, I was a bit confused. We are using code flow authorization with openid scope (https://darutk.medium.com/diagrams-of-all-the-openid-connect-flows-6968e3990660). I was a bit confused because we do not use a client secret atm, which is often associated with implicit flow, but it works because keycloak is configured to not use authorization.

@frcroth
Copy link
Member Author

frcroth commented Nov 24, 2022

Any chance we could rename features.oidcEnabled to features.openIdConnectEnabled? That would be more consistent with the other application.conf keys. (As mentioned above we tried to avoid the acronym for consistency)

Did that in the backend, frontend needs to be updated, also e2e tests will fail again, but I couldn't build them new after yarn remove-snapshots with docker compose up e2e-tests failing

@fm3
Copy link
Member

fm3 commented Nov 24, 2022

Thanks!

but I couldn't build them new after yarn remove-snapshots with docker compose up e2e-tests failing

did that work before? yarn refresh-snapshots is the standard way now, but I think that’s pretty much the same thing you described. What’s the error output? 🤔

@frcroth
Copy link
Member Author

frcroth commented Nov 24, 2022

Thanks!

but I couldn't build them new after yarn remove-snapshots with docker compose up e2e-tests failing

did that work before? yarn refresh-snapshots is the standard way now, but I think that’s pretty much the same thing you described. What’s the error output? thinking

I get

webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/annotations.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/annotations.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/annotations.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/datasets.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/datasets.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/datasets.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/misc.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/misc.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/misc.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/projects.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/projects.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/projects.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/scripts.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/scripts.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/scripts.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/tasks.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/tasks.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/tasks.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/tasktypes.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/tasktypes.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/tasktypes.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/teams.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/teams.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/teams.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/teamstructure.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/teamstructure.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/teamstructure.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/timetracking.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/timetracking.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/timetracking.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Uncaught exception in public-test/test-bundle/test/backend-snapshot-tests/users.e2e.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   Error: Cannot find module 'lz4-wasm-nodejs'
webknossos-e2e-tests-1  |   Require stack:
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/mocks/lz4.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/enzyme/e2e-setup.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/public-test/test-bundle/test/backend-snapshot-tests/users.e2e.js
webknossos-e2e-tests-1  |   - /home/sbt-user/webknossos/node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   › - node_modules/ava/lib/worker/subprocess.js
webknossos-e2e-tests-1  |   › Function.Module._load (node_modules/mock-require/index.js:14:22)
webknossos-e2e-tests-1  |   › Object.<anonymous> (public-test/test-bundle/test/mocks/lz4.js:5:35)
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   ✖ public-test/test-bundle/test/backend-snapshot-tests/users.e2e.js exited with a non-zero exit code: 1
webknossos-e2e-tests-1  |   ─
webknossos-e2e-tests-1  | 
webknossos-e2e-tests-1  |   11 uncaught exceptions
webknossos-e2e-tests-1  | error Command failed with exit code 1.
webknossos-e2e-tests-1  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
webknossos-e2e-tests-1  | 2022-11-24 16:24:30,916 [INFO] akka.actor.CoordinatedShutdown - Running CoordinatedShutdown with reason [ServerStoppedReason]
webknossos-e2e-tests-1  | 2022-11-24 16:24:30,952 [INFO] Startup - Deleting temporary files
webknossos-e2e-tests-1  | 2022-11-24 16:24:31,007 [INFO] Startup - Closing SQL Database handle
webknossos-e2e-tests-1  | 2022-11-24 16:24:31,013 [INFO] com.zaxxer.hikari.HikariDataSource - slick.db - Shutdown initiated...
webknossos-e2e-tests-1  | 2022-11-24 16:24:31,056 [INFO] com.zaxxer.hikari.HikariDataSource - slick.db - Shutdown completed.
webknossos-e2e-tests-1  | 2022-11-24 16:24:31,065 [INFO] com.scalableminds.webknossos.tracingstore.tracings.TracingDataStore - Closing TracingStore grpc channels...
webknossos-e2e-tests-1  | 2022-11-24 16:24:31,117 [INFO] swagger - Swagger - stopped.
webknossos-e2e-tests-1  | 2022-11-24 16:24:31,119 [DEBUG] controllers.AssetsMetadataProvider - Cleaning AssetsMetadata instance
webknossos-e2e-tests-1  | [error]   x pass the e2e tests
webknossos-e2e-tests-1  | [error]    1 != 0 (End2EndSpec.scala:35)
webknossos-e2e-tests-1  | [info] Total for specification End2EndSpec
webknossos-e2e-tests-1  | [info] Finished in 1 minute 18 seconds, 62 ms
webknossos-e2e-tests-1  | [info] 1 example, 1 failure, 0 error
webknossos-e2e-tests-1  | [error] Failed: Total 1, Failed 1, Errors 0, Passed 0
webknossos-e2e-tests-1  | [error] Failed tests:
webknossos-e2e-tests-1  | [error]       e2e.End2EndSpec
webknossos-e2e-tests-1  | [error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
webknossos-e2e-tests-1  | [error] Total time: 130 s (02:10), completed Nov 24, 2022, 4:24:34 PM
webknossos-e2e-tests-1 exited with code 1

,also for yarn install I get:

[4/6] ⢀ core-js
error /home/felix/scm/webknossos/node_modules/rome: Command failed.
Exit code: 1
Command: node scripts/postinstall.js
Arguments: 
Directory: /home/felix/scm/webknossos/node_modules/rome
Output:
/home/felix/scm/webknossos/node_modules/rome/scripts/postinstall.js:18
const binName = PLATFORMS?.[platform]?.[arch];
                          ^

SyntaxError: Unexpected token '.'
    at Object.compileFunction (vm.js:344:18)
    at wrapSafe (internal/modules/cjs/loader.js:1048:15)
    at Module._compile (internal/modules/cjs/loader.js:1082:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)

@fm3
Copy link
Member

fm3 commented Nov 24, 2022

yarn install was the right call for the failing snapshot tests. The new lib lz4-wasm was added in #6652 and rome was added in #6618 – so this is likely an effect of pulling the master into this branch.

Now why exactly yarn install fails, I’m uncertain. Which node version do you have? @philippotto do you have any insights here? Could it be specific to the linux distribution?

In any case, I can refresh the snapshots here to avoid blocking this PR by the install issue. But we should figure that out.

@frcroth
Copy link
Member Author

frcroth commented Nov 24, 2022

Nvm, with the new command the e2e tests run 🤷

@philippotto
Copy link
Member

@frcroth Could you have a look at the CI? See https://app.circleci.com/pipelines/github/scalableminds/webknossos/9133/workflows/463f4087-80d1-43fc-9a94-a4fb2b9cb8cc/jobs/20501

[info] compiling 6 Scala sources and 1 Java source to /home/circleci/webknossos/target/scala-2.12/classes ...
[error] /home/circleci/webknossos/app/controllers/AuthenticationController.scala:125:26: private default argument in class AuthenticationController is never used
[error]                          autoActivate: Boolean = true,
[error]                          ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

@frcroth
Copy link
Member Author

frcroth commented Nov 30, 2022

@frcroth Could you have a look at the CI? See app.circleci.com/pipelines/github/scalableminds/webknossos/9133/workflows/463f4087-80d1-43fc-9a94-a4fb2b9cb8cc/jobs/20501

[info] compiling 6 Scala sources and 1 Java source to /home/circleci/webknossos/target/scala-2.12/classes ...
[error] /home/circleci/webknossos/app/controllers/AuthenticationController.scala:125:26: private default argument in class AuthenticationController is never used
[error]                          autoActivate: Boolean = true,
[error]                          ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

@philippotto Fixed now

@frcroth
Copy link
Member Author

frcroth commented Nov 30, 2022

@philippotto I think front end needs to be adapted again because a name changed.

Any chance we could rename features.oidcEnabled to features.openIdConnectEnabled? That would be more consistent with the other application.conf keys. (As mentioned above we tried to avoid the acronym for consistency)

Btw the yarn install issue is fixed now, I was on node 13

@philippotto
Copy link
Member

@philippotto Fixed now

Great 👍

@philippotto I think front end needs to be adapted again because a name changed.

Done! For such small things, such as renaming a var, feel free to do a search&replace in the frontend folder next time :)

@frcroth frcroth requested a review from fm3 December 1, 2022 10:37
Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

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

Latest code changes look good to me. Did not re-test, but I assume you tested both cases once again? (with and without configured public key?)

Caused by empty result
@frcroth
Copy link
Member Author

frcroth commented Dec 2, 2022

Will be merged next week.

@frcroth frcroth merged commit 7b09566 into master Dec 5, 2022
@frcroth frcroth deleted the oidc branch December 5, 2022 16:10
hotzenklotz added a commit that referenced this pull request Dec 6, 2022
…cing

* 'master' of github.com:scalableminds/webknossos: (23 commits)
  Guard against invalid-mag bucket volume save actions (#6660)
  Add OIDC authentication (#6534)
  Add second (non-admin) default user to "initial data" trigger (#6666)
  Fix and improve miscellaneous things in Folders tab (#6674)
  Improves mag and voxelSize inferral for remote datasets (#6670)
  Squashed commit of the following:
  Fix import of N5 datasets by adding n5 schema to frontend validation (#6668)
  Virtual Folder Structure for Datasets (#6591)
  Ability to recover from webGL context loss (#6663)
  Fix assertion that referenced teams cannot be deleted (#6664)
  fix task summary with pending jobs (#6662)
  Only allow taskTypeId as parameter in task creation (#6640)
  Release 22.12.0 (#6661)
  Create Annotation From View Mode: Keep Activated Mapping (#6647)
  Workaround to avoid false-positive version warning (#6656)
  Fix WK-lib download snippet (#6605)
  Use LZ4 with WASM for volume saving/undo/redo (#6652)
  Fix version number extraction when building docker image (#6655)
  Pass mapping name to precompute meshes (#6651)
  Deduplicate bboxes when importing NML (#6648)
  ...
philippotto added a commit that referenced this pull request Dec 13, 2022
* Add second (non-admin) default user to "initial data" trigger (#6666)

* add second (non-admin) user to initial data trigger

* rename second user and DRY insertion method

* format

* name default organization team "Default" when inserting initial data (analoguous to general organization creation)

* Add OIDC authentication (#6534)

Co-authored-by: Florian M <[email protected]>
Co-authored-by: Philipp Otto <[email protected]>

* Guard against invalid-mag bucket volume save actions (#6660)

* [WIP] guard against invalid-mag bucket volume save actions

* avoid unnecessary creation of objects in ResolutionInfo instances

* use layer's resolution info when in wkstore adapter

* rename bucketPositionToGlobalAddress to bucketPositionToGlobalAddressOld

* get rid of bucketPositionToGlobalAddressOld

* rename bucketPositionToGlobalAddressNew to bucketPositionToGlobalAddress

* simplify getBucketExtent signature

* fix tests

* fix quick-select tool for scenarios where the color layer is available in the current mag but the volume layer isn't

* Update frontend/javascripts/test/model/binary/layers/wkstore_adapter.spec.ts

* avoid losing error chain during conversion

Co-authored-by: Philipp Otto <[email protected]>
Co-authored-by: Philipp Otto <[email protected]>

* Provide valid JSON schema (#6642)

extra `{}` cause JSON decode error in python standard JSON library and webknossos instance

Co-authored-by: Philipp Otto <[email protected]>

* Improve layout of dashboard

* Swagger annotation for shortLinkByKey (#6682)

* Bump qs from 6.5.2 to 6.5.3

Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](ljharb/qs@v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Philipp Otto <[email protected]>
Co-authored-by: frcroth <[email protected]>
Co-authored-by: Florian M <[email protected]>
Co-authored-by: Florian M <[email protected]>
Co-authored-by: Philipp Otto <[email protected]>
Co-authored-by: erjel <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

Single Sign On (SSO) Authentication
4 participants