当前位置: 首页>>代码示例>>Java>>正文


Java RegistrationResponse类代码示例

本文整理汇总了Java中net.openid.appauth.RegistrationResponse的典型用法代码示例。如果您正苦于以下问题:Java RegistrationResponse类的具体用法?Java RegistrationResponse怎么用?Java RegistrationResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RegistrationResponse类属于net.openid.appauth包,在下文中一共展示了RegistrationResponse类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateAfterRegistration

import net.openid.appauth.RegistrationResponse; //导入依赖的package包/类
@AnyThread
@NonNull
public AuthState updateAfterRegistration(
        RegistrationResponse response,
        AuthorizationException ex) {
    AuthState current = getCurrent();
    if (ex != null) {
        return current;
    }

    current.update(response);
    return replace(current);
}
 
开发者ID:openid,项目名称:AppAuth-Android,代码行数:14,代码来源:AuthStateManager.java

示例2: initializeClient

import net.openid.appauth.RegistrationResponse; //导入依赖的package包/类
/**
 * Initiates a dynamic registration request if a client ID is not provided by the static
 * configuration.
 */
@WorkerThread
private void initializeClient() {
    if (mConfiguration.getClientId() != null) {
        Log.i(TAG, "Using static client ID: " + mConfiguration.getClientId());
        // use a statically configured client ID
        mClientId.set(mConfiguration.getClientId());
        runOnUiThread(this::initializeAuthRequest);
        return;
    }

    RegistrationResponse lastResponse =
            mAuthStateManager.getCurrent().getLastRegistrationResponse();
    if (lastResponse != null) {
        Log.i(TAG, "Using dynamic client ID: " + lastResponse.clientId);
        // already dynamically registered a client ID
        mClientId.set(lastResponse.clientId);
        runOnUiThread(this::initializeAuthRequest);
        return;
    }

    // WrongThread inference is incorrect for lambdas
    // noinspection WrongThread
    runOnUiThread(() -> displayLoading("Dynamically registering client"));
    Log.i(TAG, "Dynamically registering client");

    RegistrationRequest registrationRequest = new RegistrationRequest.Builder(
            mAuthStateManager.getCurrent().getAuthorizationServiceConfiguration(),
            Collections.singletonList(mConfiguration.getRedirectUri()))
            .setTokenEndpointAuthenticationMethod(ClientSecretBasic.NAME)
            .build();

    mAuthService.performRegistrationRequest(
            registrationRequest,
            this::handleRegistrationResponse);
}
 
开发者ID:openid,项目名称:AppAuth-Android,代码行数:40,代码来源:LoginActivity.java

示例3: handleRegistrationResponse

import net.openid.appauth.RegistrationResponse; //导入依赖的package包/类
@MainThread
private void handleRegistrationResponse(
        RegistrationResponse response,
        AuthorizationException ex) {
    mAuthStateManager.updateAfterRegistration(response, ex);
    if (response == null) {
        Log.i(TAG, "Failed to dynamically register client", ex);
        displayErrorLater("Failed to register client: " + ex.getMessage(), true);
        return;
    }

    Log.i(TAG, "Dynamically registered client: " + response.clientId);
    mClientId.set(response.clientId);
    initializeAuthRequest();
}
 
开发者ID:openid,项目名称:AppAuth-Android,代码行数:16,代码来源:LoginActivity.java

示例4: makeRegistrationRequest

import net.openid.appauth.RegistrationResponse; //导入依赖的package包/类
private void makeRegistrationRequest(
        @NonNull AuthorizationServiceConfiguration serviceConfig,
        @NonNull final OpenIDIdentityProvider idp) {

    LogUtils.logd(TAG, "Making registration request to " + serviceConfig.registrationEndpoint);
    final RegistrationRequest registrationRequest = new RegistrationRequest.Builder(
            serviceConfig,
            Arrays.asList(idp.getRedirectUri()))
            .setTokenEndpointAuthenticationMethod(ClientSecretBasic.NAME)
            .build();

    mAuthService.performRegistrationRequest(
            registrationRequest,
            new AuthorizationService.RegistrationResponseCallback() {
                @Override
                public void onRegistrationRequestCompleted(
                        @Nullable RegistrationResponse registrationResponse,
                        @Nullable AuthorizationException ex) {
                    LogUtils.logd(TAG, "Registration request complete");
                    if (registrationResponse != null) {
                        idp.setClientId(registrationResponse.clientId);
                        LogUtils.logd(TAG, "Registration request complete successfully");
                        // Continue with the authentication
                        makeAuthRequest(
                                registrationResponse.request.configuration,
                                idp,
                                new AuthState(registrationResponse)
                        );
                    }
                }
            });
}
 
开发者ID:janrain,项目名称:jump.android,代码行数:33,代码来源:OpenIDAppAuthGoogle.java


注:本文中的net.openid.appauth.RegistrationResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。