mirror of
https://github.com/owncloud/android-library.git
synced 2025-07-17 15:05:42 +00:00
Use ownCloud client base url to perform oidc discovery
This commit is contained in:
parent
0fc3f7668d
commit
f289746c2f
owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/oauth/services
@ -23,11 +23,12 @@
|
||||
*/
|
||||
package com.owncloud.android.lib.resources.oauth.services
|
||||
|
||||
import com.owncloud.android.lib.common.OwnCloudClient
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult
|
||||
import com.owncloud.android.lib.resources.oauth.responses.OIDCDiscoveryResponse
|
||||
|
||||
interface OIDCService {
|
||||
|
||||
fun getOIDCServerDiscovery(baseUrl: String): RemoteOperationResult<OIDCDiscoveryResponse>
|
||||
fun getOIDCServerDiscovery(ownCloudClient: OwnCloudClient): RemoteOperationResult<OIDCDiscoveryResponse>
|
||||
|
||||
}
|
||||
|
@ -23,9 +23,7 @@
|
||||
*/
|
||||
package com.owncloud.android.lib.resources.oauth.services.implementation
|
||||
|
||||
import android.net.Uri
|
||||
import com.owncloud.android.lib.common.OwnCloudClient
|
||||
import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult
|
||||
import com.owncloud.android.lib.resources.oauth.GetOIDCDiscoveryRemoteOperation
|
||||
import com.owncloud.android.lib.resources.oauth.responses.OIDCDiscoveryResponse
|
||||
@ -33,12 +31,9 @@ import com.owncloud.android.lib.resources.oauth.services.OIDCService
|
||||
|
||||
class OCOIDCService() : OIDCService {
|
||||
|
||||
override fun getOIDCServerDiscovery(baseUrl: String): RemoteOperationResult<OIDCDiscoveryResponse> =
|
||||
GetOIDCDiscoveryRemoteOperation().execute(createClientFromPath(baseUrl))
|
||||
|
||||
private fun createClientFromPath(path: String): OwnCloudClient =
|
||||
OwnCloudClient(Uri.parse(path)).apply {
|
||||
credentials = OwnCloudCredentialsFactory.getAnonymousCredentials()
|
||||
}
|
||||
override fun getOIDCServerDiscovery(
|
||||
ownCloudClient: OwnCloudClient
|
||||
): RemoteOperationResult<OIDCDiscoveryResponse> =
|
||||
GetOIDCDiscoveryRemoteOperation().execute(ownCloudClient)
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user