Uncomplete OIDC dynamic client registration request [BUG]

Open Beginner friendly
#3,720 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
android, kotlin

Research direction

Start in owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/oauth/params/ClientRegistrationParams.kt and compare its request fields with RFC 7591 and the Ory/Hydra API reference linked in the issue. Ensure the dynamic registration request includes the required scope and grant types, then verify that a newly registered client receives the expected parameters with the reported OCIS and custom OIDC provider setup.

Written by the indexing model from the issue text.

Description

Behaviour

The android app tries to do a OIDC client registration with a custom OIDC provider.
This works successful but the registered client has some "optimistic" assumptions.

Expected behaviour

The client does a full defined request, with all arguments.

Steps to reproduce

A bit hard to describe I used:

  • OCIS v 2.0.0beta5
  • Ory/Hydra as Oauth2 Provider
  • Custom identity provider

If you need a more precise description ask, it is my testsystem, can also give access if requested.

Can this problem be reproduced with the official owncloud server?
(url: https://demo.owncloud.org, user: test, password: test)
NO

Environment data

Android version:
Lineageos 18.1

Device model:

Stock or customized system:

ownCloud app version:
github - master

ownCloud server version:
OCIS 2.0.0beta5

Logs
Web server error log
Insert your webserver log here
ownCloud log (data/owncloud.log)
Insert your ownCloud log here

Sample Patch (but quick and dirty):

--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/oauth/params/ClientRegistrationParams.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/oauth/params/ClientRegistrationParams.kt
@@ -46,6 +46,8 @@ data class ClientRegistrationParams(
             put(PARAM_CLIENT_NAME, clientName)
             put(PARAM_REDIRECT_URIS, JSONArray(redirectUris))
             put(PARAM_TOKEN_ENDPOINT_AUTH_METHOD, tokenEndpointAuthMethod)
+            put(PARAM_SCOPE, "openid offline_access email profile")
+            put("grant_types", JSONArray(arrayOf("authorization_code","refresh_token")))
         }.toString().toRequestBody(CONTENT_TYPE_JSON.toMediaType())
 
     companion object {
@@ -53,5 +55,6 @@ data class ClientRegistrationParams(
         private const val PARAM_CLIENT_NAME = "client_name"
         private const val PARAM_TOKEN_ENDPOINT_AUTH_METHOD = "token_endpoint_auth_method"
         private const val PARAM_REDIRECT_URIS = "redirect_uris"
+        private const val PARAM_SCOPE = "scope"
     }
 }

This patch addes the arguments:

  • scope - defines witch sopes should be allowed to request, default not defined in rfc
  • grant_type - default is only ["authorization_code"] but ist should be IMHO ["authorization_code","refresh_token"]

The current implementation assumes that the default parameter are correct but that is implementation specific.
I could apply the patch above to a testbuild on my phone and it looks like it works.
The client does registration a new OIDC client with the right paramters.
as api reference I used: https://www.ory.sh/docs/hydra/reference/api
and the rfc: https://datatracker.ietf.org/doc/html/rfc7591#section-2

I'm not so into Kotline, so I would let to a dev to do the nice implementation

Dominant language
Kotlin
Stars
4.2k
Forks
3.1k
Avg merge
1d 12h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from owncloud/android

All issues in owncloud/android

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.