本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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)
);
}
}
});
}