本文整理汇总了Java中net.openid.appauth.AuthorizationResponse类的典型用法代码示例。如果您正苦于以下问题:Java AuthorizationResponse类的具体用法?Java AuthorizationResponse怎么用?Java AuthorizationResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthorizationResponse类属于net.openid.appauth包,在下文中一共展示了AuthorizationResponse类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: notifyUserAgentResponse
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
public void notifyUserAgentResponse(Intent data, int returnCode) {
if (returnCode != app.RC_AUTH) {
failLogin(new AuthException("User authorization was cancelled"));
return;
}
AuthorizationResponse resp = AuthorizationResponse.fromIntent(data);
AuthorizationException ex = AuthorizationException.fromIntent(data);
if (resp == null) {
failLogin(new AuthException("User authorization failed"));
return;
} else {
authState.update(resp, ex);
finishUserAuth();
}
}
开发者ID:approov,项目名称:AppAuth-OAuth2-Books-Demo,代码行数:17,代码来源:AuthRepo.java
示例2: extractResponseData
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private Intent extractResponseData(Uri responseUri) {
if (responseUri.getQueryParameterNames().contains(AuthorizationException.PARAM_ERROR)) {
return AuthorizationException.fromOAuthRedirect(responseUri).toIntent();
} else {
AuthorizationResponse response = new AuthorizationResponse.Builder(mAuthRequest)
.fromUri(responseUri)
.build();
if (mAuthRequest.state == null &&
response.state != null ||
(mAuthRequest.state != null && !mAuthRequest.state.equals(response.state))) {
Logger.warn("State returned in authorization response (%s) does not match state "
+ "from request (%s) - discarding response",
response.state,
mAuthRequest.state);
return AuthorizationException.AuthorizationRequestErrors.STATE_MISMATCH.toIntent();
}
return response.toIntent();
}
}
开发者ID:hadiidbouk,项目名称:AppAuthWebView-Android,代码行数:24,代码来源:AppAuthWebView.java
示例3: handleAuthorizationResponse
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
/**
* Exchanges the code, for the {@link TokenResponse}.
*
* @param intent represents the {@link Intent} from the Custom Tabs or the System Browser.
*/
private void handleAuthorizationResponse(@NonNull Intent intent) {
AuthorizationResponse response = AuthorizationResponse.fromIntent(intent);
AuthorizationException error = AuthorizationException.fromIntent(intent);
final AuthState authState = new AuthState(response, error);
if (response != null) {
Log.i(LOG_TAG, String.format("Handled Authorization Response %s ", authState.toJsonString()));
AuthorizationService service = new AuthorizationService(this);
service.performTokenRequest(response.createTokenExchangeRequest(), new AuthorizationService.TokenResponseCallback() {
@Override
public void onTokenRequestCompleted(@Nullable TokenResponse tokenResponse, @Nullable AuthorizationException exception) {
if (exception != null) {
Log.w(LOG_TAG, "Token Exchange failed", exception);
} else {
if (tokenResponse != null) {
authState.update(tokenResponse, exception);
persistAuthState(authState);
Log.i(LOG_TAG, String.format("Token Response [ Access Token: %s, ID Token: %s ]", tokenResponse.accessToken, tokenResponse.idToken));
}
}
}
});
}
}
开发者ID:googlecodelabs,项目名称:appauth-android-codelab,代码行数:29,代码来源:MainActivity.java
示例4: handleAuthorizationResponse
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
/**
* Exchanges the code, for the {@link TokenResponse}.
*
* @param intent represents the {@link Intent} from the Custom Tabs or the System Browser.
*/
private void handleAuthorizationResponse(@NonNull Intent intent) {
AuthorizationResponse response = AuthorizationResponse.fromIntent(intent);
AuthorizationException error = AuthorizationException.fromIntent(intent);
final AuthState authState = new AuthState(response, error);
if (response != null) {
Log.i(LOG_TAG, String.format("Handled Authorization Response %s ", authState.toJsonString()));
AuthorizationService service = new AuthorizationService(this);
service.performTokenRequest(response.createTokenExchangeRequest(), new AuthorizationService.TokenResponseCallback() {
@Override
public void onTokenRequestCompleted(@Nullable TokenResponse tokenResponse, @Nullable AuthorizationException exception) {
if (exception != null) {
Log.w(LOG_TAG, "Token Exchange failed", exception);
} else {
if (tokenResponse != null) {
authState.update(tokenResponse, exception);
persistAuthState(authState);
Log.i(LOG_TAG, String.format("Token Response [ Access Token: %s, ID Token: %s ]", tokenResponse.accessToken, tokenResponse.idToken));
}
}
}
});
}
}
开发者ID:googlecodelabs,项目名称:appauth-android-codelab,代码行数:30,代码来源:MainActivity.java
示例5: getAccessToken
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
private void getAccessToken(AuthorizationResponse authorizationResponse) {
AuthorizationService service = new AuthorizationService(context);
service.performTokenRequest(
authorizationResponse.createTokenExchangeRequest(),
new AuthorizationService.TokenResponseCallback() {
@Override public void onTokenRequestCompleted(
TokenResponse resp, AuthorizationException ex) {
if (ex == null && resp != null) {
SocialNetworkAccount account = new SocialNetworkAccount(
IdentityProvider.GOOGLE, resp.accessToken);
sendAuthSuccess(account);
} else {
DebugLog.logException(ex);
sendAuthFailure();
}
}
});
service.dispose();
}
开发者ID:Microsoft,项目名称:EmbeddedSocial-Android-SDK,代码行数:20,代码来源:GoogleResponseHandler.java
示例6: tryToGetTokens
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
@WorkerThread
private void tryToGetTokens() {
AuthorizationResponse response = AuthorizationResponse.fromIntent(getIntent());
AuthorizationException ex = AuthorizationException.fromIntent(getIntent());
if (response != null || ex != null) {
stateManager.updateAfterAuthorization(response, ex);
}
if (response != null && response.authorizationCode != null) {
stateManager.updateAfterAuthorization(response, ex);
exchangeAuthorizationCode(response);
} else if (ex != null) {
log("Authorization flow failed: " + ex.getMessage());
showRestartButton();
} else {
log("No authorization state retained - reauthorization required");
showRestartButton();
}
}
开发者ID:p7s1-ctf,项目名称:7pass-android-sample,代码行数:21,代码来源:PostLoginActivity.java
示例7: startCodeExchange
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
private void startCodeExchange() {
Log.i(TAG, "Starting code exchange");
loginListener.onEvent(AuthRepo.this, AUTH_CODE_EXCHANGE_START);
AuthorizationResponse resp = authState.getLastAuthorizationResponse();
authService.performTokenRequest(
resp.createTokenExchangeRequest(), this::onTokenRequestCompleted);
}
开发者ID:approov,项目名称:AppAuth-OAuth2-Books-Demo,代码行数:10,代码来源:AuthRepo.java
示例8: exchangeAuthorizationCode
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
private void exchangeAuthorizationCode(AuthorizationResponse authorizationResponse) {
HashMap<String, String> additionalParams = new HashMap<>();
if (getClientSecretFromIntent(getIntent()) != null) {
additionalParams.put("client_secret", getClientSecretFromIntent(getIntent()));
}
performTokenRequest(authorizationResponse.createTokenExchangeRequest(additionalParams));
}
开发者ID:iainmcgin,项目名称:AppAuth-Demo,代码行数:8,代码来源:TokenActivity.java
示例9: updateAfterAuthorization
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
@AnyThread
@NonNull
public AuthState updateAfterAuthorization(
@Nullable AuthorizationResponse response,
@Nullable AuthorizationException ex) {
AuthState current = getCurrent();
current.update(response, ex);
return replace(current);
}
开发者ID:openid,项目名称:AppAuth-Android,代码行数:10,代码来源:AuthStateManager.java
示例10: onStart
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
if (mExecutor.isShutdown()) {
mExecutor = Executors.newSingleThreadExecutor();
}
if (mStateManager.getCurrent().isAuthorized()) {
displayAuthorized();
return;
}
// the stored AuthState is incomplete, so check if we are currently receiving the result of
// the authorization flow from the browser.
AuthorizationResponse response = AuthorizationResponse.fromIntent(getIntent());
AuthorizationException ex = AuthorizationException.fromIntent(getIntent());
if (response != null || ex != null) {
mStateManager.updateAfterAuthorization(response, ex);
}
if (response != null && response.authorizationCode != null) {
// authorization code exchange is required
mStateManager.updateAfterAuthorization(response, ex);
exchangeAuthorizationCode(response);
} else if (ex != null) {
displayNotAuthorized("Authorization flow failed: " + ex.getMessage());
} else {
displayNotAuthorized("No authorization state retained - reauthorization required");
}
}
开发者ID:openid,项目名称:AppAuth-Android,代码行数:33,代码来源:TokenActivity.java
示例11: exchangeAuthorizationCode
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
@MainThread
private void exchangeAuthorizationCode(AuthorizationResponse authorizationResponse) {
displayLoading("Exchanging authorization code");
performTokenRequest(
authorizationResponse.createTokenExchangeRequest(),
this::handleCodeExchangeResponse);
}
开发者ID:openid,项目名称:AppAuth-Android,代码行数:8,代码来源:TokenActivity.java
示例12: handleAuthorizationResponse
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
public void handleAuthorizationResponse(Intent intent) {
AuthorizationResponse resp = AuthorizationResponse.fromIntent(intent);
AuthorizationException ex = AuthorizationException.fromIntent(intent);
if (resp != null) {
getAccessToken(resp);
} else {
DebugLog.logException(ex);
sendAuthFailure();
}
}
开发者ID:Microsoft,项目名称:EmbeddedSocial-Android-SDK,代码行数:11,代码来源:GoogleResponseHandler.java
示例13: exchangeAuthorizationCode
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
/**
* Performs Authorization code exchange
*/
private void exchangeAuthorizationCode(AuthorizationResponse authorizationResponse) {
performTokenRequest(authorizationResponse.createTokenExchangeRequest());
}
开发者ID:oktadeveloper,项目名称:okta-openidconnect-appauth-android,代码行数:7,代码来源:OktaAppAuth.java
示例14: exchangeAuthorizationCode
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
@WorkerThread
private void exchangeAuthorizationCode(AuthorizationResponse response) {
log("Received authorization code. Exchanging it for tokens now...");
performTokenRequest(response.createTokenExchangeRequest(), this::handleCodeExchangeResponse);
}
开发者ID:p7s1-ctf,项目名称:7pass-android-sample,代码行数:6,代码来源:PostLoginActivity.java
示例15: exchangeAuthorizationCode
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
private void exchangeAuthorizationCode(AuthorizationResponse authorizationResponse) {
performTokenRequest(authorizationResponse.createTokenExchangeRequest());
}
开发者ID:janrain,项目名称:jump.android,代码行数:4,代码来源:OpenIDAppAuthTokenActivity.java
示例16: exchangeAuthorizationCode
import net.openid.appauth.AuthorizationResponse; //导入依赖的package包/类
private void exchangeAuthorizationCode(AuthorizationResponse authorizationResponse) {
performTokenRequest(authorizationResponse.createTokenExchangeRequest());
}
开发者ID:pingidentity,项目名称:Android-AppAuth-Sample-Application,代码行数:5,代码来源:MainActivity.java
注:本文中的net.openid.appauth.AuthorizationResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论