elan-ev / tobira

Video portal for Opencast
https://elan-ev.github.io/tobira/
Apache License 2.0
22 stars 17 forks source link

Unable to login to Tobira with Opencast LDAP users #1180

Closed Nepoh closed 3 months ago

Nepoh commented 3 months ago

Hi,

I am not sure whether this is a bug or intentionally not supported: When using the basic Opencast login mechanism

[auth]
source = "tobira-session"
session.from_login_credentials = "opencast"

I can successfully log in to Tobira with the Opencast admin account, but not with an Opencast LDAP user. Authentication fails with the following error:

ERROR tobira::auth::handlers >  Error occured while checking Opencast login data: Could not deserialize `/info/me.json` response: missing field `name` at line 1 column 2376

When logged in as admin, /info/me.json looks like this:

{
  ...
  "user": {
    "provider": "opencast",
    "name": "Administrator",
    "email": "opencast@example.com",
    "username": "admin"
  }
}

for LDAP users on the other hand, it looks like this:

{
  ...
  "user": {
    "provider": "ldap",
    "username": "xxxxxx"
  }
}

I guess Tobira expects the name field to be present, but it looks like this is not the case for all Opencast user providers. May be falling back to username if there is no name in the response would be an option?

Btw: I am running Tobira 2.8 and Opencast 14.4 (but JSON response for LDAP users looks the same in opencast 15.2).

LukasKalbertodt commented 3 months ago

Thank you for the well-written issue! I wasn't sure whether LDAP would work like this, but this specific error is unexpected for sure. I will look into it.

LukasKalbertodt commented 3 months ago

This is likely a problem with your LDAP configuration in Opencast. Take a look at this part of org.opencastproject.userdirectory.ldap.cfg.template:

https://github.com/opencast/opencast/blob/99fbf96fbb1cd0cae80be1fe1e1c5a3b20d5f68a/etc/org.opencastproject.userdirectory.ldap.cfg.template#L53-L64

You probably have to set the name line. See the docs for more information. Please report back if this worked!

Nepoh commented 3 months ago

You are right! After adjusting the configuration, Opencast correctly returns the name field in info/me.json for LDAP users and login to Tobira works as expected.

Thanks a lot for the hint and sorry for the hassle!

LukasKalbertodt commented 3 months ago

No worries, I'm glad the problem is fixed for you!