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

Implement basic OIDC core server handling #12567

Closed
wants to merge 3 commits into from
Closed

Conversation

tisoft
Copy link

@tisoft tisoft commented Nov 21, 2018

Allow Nextcloud to be used as a OpenID Connect provider. OpenID Connect Clients can authenticate against it. Fixes a part of #8846.

Manually tested with the OpenID Connect Playground and the OpenID Connect Generic Wordpress plugin

This is a minimal implementation. It could be extended by the following:

  • Handling claim requests
  • Supporting nonce values for additional security
  • Providing a UserInfo Backend
  • Providing a well-known URL handler
  • and probably more...

This is my first contribution to nextcloud, so I would be very helpful if someone would point out the shortcomings of my code. I will add a test case, but wanted to have feedback first, if this has any chance on being accepted.

@tisoft
Copy link
Author

tisoft commented Nov 22, 2018

@rullzer Would you be willing to review this, since you worked as the last person on these files?

@rullzer
Copy link
Member

rullzer commented Nov 22, 2018

@tisoft yes I will :)

I must admit I have not read up a lot on OIDC. I would need to do that as well. I'll try to look into this and get back to you.

@rullzer rullzer self-requested a review November 22, 2018 10:11
@MorrisJobke MorrisJobke added the 3. to review Waiting for reviews label Nov 22, 2018
@MorrisJobke MorrisJobke added this to the Nextcloud 16 milestone Nov 22, 2018
@tisoft tisoft force-pushed the oidc branch 2 times, most recently from 3f95ae5 to d3585f7 Compare January 28, 2019 10:49
Allow Nextcloud to be used as a OpenID Connect server. CLients can authenticate against it.

Signed-off-by: Markus Heberling <markus.heberling@hengsbeck.de>
@tisoft
Copy link
Author

tisoft commented Jan 28, 2019

I have rebased to latest master. The test failures seem unrelated to me. Anything I can do to help the review process?

@rullzer
Copy link
Member

rullzer commented Jan 31, 2019

@tisoft sorry for having this around for so long. Reading up on openid is still on my list but time 😉

Could you point me to the related RFC/component of openID I have to read up on to check this?

Also I'll do a pass over the code tomorrow to give some more feedback. Thnx again.

@tisoft
Copy link
Author

tisoft commented Jan 31, 2019

I tried to implement the minimal required elements of the specification here: https://openid.net/specs/openid-connect-core-1_0.html

I have especially focused on the parts noted in the section 15.1. Mandatory to Implement Features for All OpenID Providers. In my opinion that section basically says, I must return an id_token, with some required fields and I must "support" some url parameters. Where "support" means, I can ignore them, as long as its usage does not lead to an error).

Section 15.2 defines more requirements, that I would love to implement but that isn't basic anymore. :) I wanted to start with the most minimalistic implementation, that is actually usable.

apps/oauth2/lib/Controller/OauthApiController.php Outdated Show resolved Hide resolved
'auth_time' => $this->time->getTime(),

// optional, can be requested by claims, we don't support requesting claims as of now, so we just send them always
'email' => $user->getEMailAddress(),
Copy link
Member

Choose a reason for hiding this comment

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

Is it a problem if those are empty?

Copy link
Author

Choose a reason for hiding this comment

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

As I understand it, they can be left empty.

$base64UrlPayload = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($payload));

// Create Signature Hash
$signature = hash_hmac('sha256', $base64UrlHeader . "." . $base64UrlPayload, $client->getSecret(), true);
Copy link
Member

Choose a reason for hiding this comment

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

So the signature is required it seems. But how can it every be validated?

Copy link
Author

Choose a reason for hiding this comment

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

The OpenID Connect client will do the same hash calculation on his side. Since the client knows the oauth client secret he can do that. That way the signature can be verified.

@kesselb
Copy link
Contributor

kesselb commented Feb 15, 2019

I think it would be useful to add https://github.com/RobDWaller/ReallySimpleJWT as dependency so that we get automatic updates.

@tisoft
Copy link
Author

tisoft commented Feb 15, 2019

I think it would be useful to add https://github.com/RobDWaller/ReallySimpleJWT as dependency so that we get automatic updates.

I was unsure on the process to get external dependencies in, so I tried to do this without :) But if using a library is preferred, I can change this.

Signed-off-by: Markus Heberling <markus.heberling@hengsbeck.de>
@MorrisJobke
Copy link
Member

Hi @tisoft - sorry that we didn't had time to look into this for the Nextcloud 16 milestone. We were quite busy with other tasks. We still appreciate the work you put into this, but the freeze for Nextcloud 16 is active since last Friday and I will put this into the Nextcloud 17 bucket. I hope that is okay for you.

@MorrisJobke MorrisJobke modified the milestones: Nextcloud 16, Nextcloud 17 Mar 6, 2019
@tisoft
Copy link
Author

tisoft commented Mar 6, 2019

@MorrisJobke No problem. Just ping me, when I need to change something. 😄

@MorrisJobke MorrisJobke mentioned this pull request Jul 17, 2019
28 tasks
@rullzer rullzer removed this from the Nextcloud 18 milestone Dec 9, 2019
@MrMcX
Copy link

MrMcX commented Jan 14, 2020

Is this still worked on? And is there anything someone not from the nextcloud team can do?

@tisoft
Copy link
Author

tisoft commented Jan 15, 2020

I‘m still willing to bring this in. Would need a feedback from the Nextcloud team.

@kesselb
Copy link
Contributor

kesselb commented Jan 15, 2020

cc @rullzer

@Ornias1993
Copy link

It's time someone from Nextcloud steps up to the plate and do SOMETHING with this.
Even if it's a "dont want it", thats more than just plainy ignoring this.

So @rullzer and @MorrisJobke is anyone interested in getting this merged/reviewed before... lets say... 2025? or shall we start working op Startrek-Connect instead for Nextcloud 654?

@yrammos
Copy link

yrammos commented Apr 28, 2020

Fervently hoping this gets triaged for NC20 @rullzer @MorrisJobke

@rullzer
Copy link
Member

rullzer commented Jul 2, 2020

This is one of those things where as I said I'm not against it. But we'll really need proper intergration test of OAuth (and then of course of OIDC as well). Since else this becomes this untested complex beast.

If anybody is up to add those please do. That would help a lot. And then we can move this forward as well.

@MorrisJobke MorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jul 7, 2020
@ChristophWurst
Copy link
Member

This is one of those things where as I said I'm not against it. But we'll really need proper intergration test of OAuth (and then of course of OIDC as well). Since else this becomes this untested complex beast.

if I'm not mistaken this is still not done. shall we close this for now?

@LukasReschke
Copy link
Member

Closing for now as there has been no traction on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants