Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit f289746

Browse files
committed
Use ownCloud client base url to perform oidc discovery
1 parent 0fc3f76 commit f289746

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/oauth/services/OIDCService.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323
*/
2424
package com.owncloud.android.lib.resources.oauth.services
2525

26+
import com.owncloud.android.lib.common.OwnCloudClient
2627
import com.owncloud.android.lib.common.operations.RemoteOperationResult
2728
import com.owncloud.android.lib.resources.oauth.responses.OIDCDiscoveryResponse
2829

2930
interface OIDCService {
3031

31-
fun getOIDCServerDiscovery(baseUrl: String): RemoteOperationResult<OIDCDiscoveryResponse>
32+
fun getOIDCServerDiscovery(ownCloudClient: OwnCloudClient): RemoteOperationResult<OIDCDiscoveryResponse>
3233

3334
}

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/oauth/services/implementation/OCOIDCService.kt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,17 @@
2323
*/
2424
package com.owncloud.android.lib.resources.oauth.services.implementation
2525

26-
import android.net.Uri
2726
import com.owncloud.android.lib.common.OwnCloudClient
28-
import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory
2927
import com.owncloud.android.lib.common.operations.RemoteOperationResult
3028
import com.owncloud.android.lib.resources.oauth.GetOIDCDiscoveryRemoteOperation
3129
import com.owncloud.android.lib.resources.oauth.responses.OIDCDiscoveryResponse
3230
import com.owncloud.android.lib.resources.oauth.services.OIDCService
3331

3432
class OCOIDCService() : OIDCService {
3533

36-
override fun getOIDCServerDiscovery(baseUrl: String): RemoteOperationResult<OIDCDiscoveryResponse> =
37-
GetOIDCDiscoveryRemoteOperation().execute(createClientFromPath(baseUrl))
38-
39-
private fun createClientFromPath(path: String): OwnCloudClient =
40-
OwnCloudClient(Uri.parse(path)).apply {
41-
credentials = OwnCloudCredentialsFactory.getAnonymousCredentials()
42-
}
34+
override fun getOIDCServerDiscovery(
35+
ownCloudClient: OwnCloudClient
36+
): RemoteOperationResult<OIDCDiscoveryResponse> =
37+
GetOIDCDiscoveryRemoteOperation().execute(ownCloudClient)
4338

4439
}

0 commit comments

Comments
 (0)