當前位置: 首頁>>代碼示例>>Java>>正文


Java ResponseMode類代碼示例

本文整理匯總了Java中com.nimbusds.oauth2.sdk.ResponseMode的典型用法代碼示例。如果您正苦於以下問題:Java ResponseMode類的具體用法?Java ResponseMode怎麽用?Java ResponseMode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ResponseMode類屬於com.nimbusds.oauth2.sdk包,在下文中一共展示了ResponseMode類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleAuthorizationCodeFlow

import com.nimbusds.oauth2.sdk.ResponseMode; //導入依賴的package包/類
private AuthenticationSuccessResponse handleAuthorizationCodeFlow(AuthenticationRequest authRequest,
		OIDCClientInformation client, HttpServletRequest request, Subject subject) throws GeneralException {
	ResponseMode responseMode = authRequest.impliedResponseMode();
	ClientID clientId = authRequest.getClientID();
	URI redirectUri = authRequest.getRedirectionURI();
	Scope requestedScope = authRequest.getScope();
	CodeChallenge codeChallenge = authRequest.getCodeChallenge();
	CodeChallengeMethod codeChallengeMethod = authRequest.getCodeChallengeMethod();
	Nonce nonce = authRequest.getNonce();

	Instant authenticationTime = Instant.ofEpochMilli(request.getSession().getCreationTime());
	ACR acr = this.acr;
	AMR amr = AMR.PWD;
	SessionID sessionId = new SessionID(request.getSession().getId());
	State sessionState = this.sessionManagementEnabled ? State.parse(sessionId.getValue()) : null;

	Scope scope = this.scopeResolver.resolve(subject, requestedScope, client.getOIDCMetadata());
	AuthorizationCodeContext context = new AuthorizationCodeContext(subject, clientId, redirectUri, scope,
			authenticationTime, acr, amr, sessionId, codeChallenge, codeChallengeMethod, nonce);
	AuthorizationCode code = this.authorizationCodeService.create(context);

	return new AuthenticationSuccessResponse(redirectUri, code, null, null, authRequest.getState(), sessionState,
			responseMode);
}
 
開發者ID:vpavic,項目名稱:simple-openid-provider,代碼行數:25,代碼來源:AuthorizationEndpoint.java

示例2: handleImplicitFlow

import com.nimbusds.oauth2.sdk.ResponseMode; //導入依賴的package包/類
private AuthenticationSuccessResponse handleImplicitFlow(AuthenticationRequest authRequest,
		OIDCClientInformation client, HttpServletRequest request, Subject subject) throws GeneralException {
	ResponseType responseType = authRequest.getResponseType();
	ResponseMode responseMode = authRequest.impliedResponseMode();
	URI redirectUri = authRequest.getRedirectionURI();
	Scope requestedScope = authRequest.getScope();
	State state = authRequest.getState();
	Nonce nonce = authRequest.getNonce();

	Instant authenticationTime = Instant.ofEpochMilli(request.getSession().getCreationTime());
	ACR acr = this.acr;
	AMR amr = AMR.PWD;
	SessionID sessionId = new SessionID(request.getSession().getId());
	State sessionState = this.sessionManagementEnabled ? State.parse(sessionId.getValue()) : null;

	Scope scope = this.scopeResolver.resolve(subject, requestedScope, client.getOIDCMetadata());
	AccessToken accessToken = null;

	if (responseType.contains(ResponseType.Value.TOKEN)) {
		AccessTokenRequest accessTokenRequest = new AccessTokenRequest(subject, client, scope);
		accessToken = this.tokenService.createAccessToken(accessTokenRequest);
	}

	IdTokenRequest idTokenRequest = new IdTokenRequest(subject, client, scope, authenticationTime, acr, amr,
			sessionId, nonce, accessToken, null);
	JWT idToken = this.tokenService.createIdToken(idTokenRequest);

	return new AuthenticationSuccessResponse(redirectUri, null, idToken, accessToken, state, sessionState,
			responseMode);
}
 
開發者ID:vpavic,項目名稱:simple-openid-provider,代碼行數:31,代碼來源:AuthorizationEndpoint.java

示例3: handleHybridFlow

import com.nimbusds.oauth2.sdk.ResponseMode; //導入依賴的package包/類
private AuthenticationSuccessResponse handleHybridFlow(AuthenticationRequest authRequest,
		OIDCClientInformation client, HttpServletRequest request, Subject subject) throws GeneralException {
	ResponseType responseType = authRequest.getResponseType();
	ResponseMode responseMode = authRequest.impliedResponseMode();
	ClientID clientId = authRequest.getClientID();
	URI redirectUri = authRequest.getRedirectionURI();
	Scope requestedScope = authRequest.getScope();
	State state = authRequest.getState();
	CodeChallenge codeChallenge = authRequest.getCodeChallenge();
	CodeChallengeMethod codeChallengeMethod = authRequest.getCodeChallengeMethod();
	Nonce nonce = authRequest.getNonce();

	Instant authenticationTime = Instant.ofEpochMilli(request.getSession().getCreationTime());
	ACR acr = this.acr;
	AMR amr = AMR.PWD;
	SessionID sessionId = new SessionID(request.getSession().getId());
	State sessionState = this.sessionManagementEnabled ? State.parse(sessionId.getValue()) : null;

	Scope scope = this.scopeResolver.resolve(subject, requestedScope, client.getOIDCMetadata());
	AuthorizationCodeContext context = new AuthorizationCodeContext(subject, clientId, redirectUri, scope,
			authenticationTime, acr, amr, sessionId, codeChallenge, codeChallengeMethod, nonce);
	AuthorizationCode code = this.authorizationCodeService.create(context);
	AccessToken accessToken = null;

	if (responseType.contains(ResponseType.Value.TOKEN)) {
		AccessTokenRequest accessTokenRequest = new AccessTokenRequest(subject, client, scope);
		accessToken = this.tokenService.createAccessToken(accessTokenRequest);
	}

	JWT idToken = null;

	if (responseType.contains(OIDCResponseTypeValue.ID_TOKEN)) {
		IdTokenRequest idTokenRequest = new IdTokenRequest(subject, client, scope, authenticationTime, acr, amr,
				sessionId, nonce, accessToken, code);
		idToken = this.tokenService.createIdToken(idTokenRequest);
	}

	return new AuthenticationSuccessResponse(redirectUri, code, idToken, accessToken, state, sessionState,
			responseMode);
}
 
開發者ID:vpavic,項目名稱:simple-openid-provider,代碼行數:41,代碼來源:AuthorizationEndpoint.java

示例4: getDefaultOPMetadata

import com.nimbusds.oauth2.sdk.ResponseMode; //導入依賴的package包/類
protected OIDCProviderMetadata getDefaultOPMetadata() throws ParseException {
	Issuer issuer = getMetadataIssuer();
	List<SubjectType> subjectTypes = Arrays.asList(SubjectType.PUBLIC);
	URI jwksUri = UriBuilder.fromUri(baseUri).path(JWKS_PATH).build();
	OIDCProviderMetadata md = new OIDCProviderMetadata(issuer, subjectTypes, jwksUri);
	md.applyDefaults();

	// endpoints
	URI authzEndpt = getMetadataAuthorizationEndpoint();
	URI tokenEndpt = getMetadataTokenEndpoint();
	URI userInfoEndpt = getMetadataUserinfoEndpoint();
	URI registrationEndpt = getMetadataRegistrationEndpoint();
	md.setAuthorizationEndpointURI(authzEndpt);
	md.setTokenEndpointURI(tokenEndpt);
	md.setUserInfoEndpointURI(userInfoEndpt);
	md.setRegistrationEndpointURI(registrationEndpt);

	// , ResponseType.parse("id_token"), ResponseType.parse("token id_token"));
	Scope scopes = new Scope("openid");
	List<ResponseType> responseTypes = Arrays.asList(ResponseType.parse("code"), ResponseType.parse("id_token"),
			ResponseType.parse("token id_token"));
	List<ResponseMode> responseModes = Arrays.asList(ResponseMode.QUERY, ResponseMode.FRAGMENT, ResponseMode.FORM_POST);
	List<GrantType> grantTypes = Arrays.asList(GrantType.AUTHORIZATION_CODE, GrantType.IMPLICIT);
	md.setScopes(scopes);
	md.setResponseTypes(responseTypes);
	md.setResponseModes(responseModes);
	md.setGrantTypes(grantTypes);

	// algorithms
	List<JWSAlgorithm> jwsAlgs = Arrays.asList(JWSAlgorithm.RS256, JWSAlgorithm.parse("none"));
	md.setIDTokenJWSAlgs(jwsAlgs);

	List<ClientAuthenticationMethod> authMethods = Arrays.asList(ClientAuthenticationMethod.CLIENT_SECRET_BASIC);
	md.setTokenEndpointAuthMethods(authMethods);

	List<Display> displays = Arrays.asList(Display.PAGE);
	md.setDisplays(displays);

	return md;
}
 
開發者ID:RUB-NDS,項目名稱:PrOfESSOS,代碼行數:41,代碼來源:AbstractOPImplementation.java

示例5: buildAuthorizationURL

import com.nimbusds.oauth2.sdk.ResponseMode; //導入依賴的package包/類
private String buildAuthorizationURL(HttpServerExchange exchange) {
	try {
		ClientID clientId = new ClientID(oidcProvider.getClientId());
		ResponseType responseType = new ResponseType(oidcProvider.getResponseType());
		ResponseMode responseMode = ResponseMode.FORM_POST;
		Prompt prompt = new Prompt(Prompt.Type.LOGIN);
		Display display = Display.PAGE;
		Scope scope = Scope.parse(oidcProvider.getScope());
		String redirectURL = RedirectBuilder.redirect(exchange, redirectPath, false);
		URI redirectURI = new URI(redirectURL);
		String returnURL = null;
		if (!exchange.getRequestPath().equals(redirectPath)) {
			returnURL = RedirectBuilder.redirect(exchange, exchange.getRelativePath());
		} else {
			returnURL = RedirectBuilder.redirect(exchange, "/", false);
		}
		String stateValue = persistState(returnURL, exchange);
		State state = stateValue != null ? new State(stateValue) : null;
		Nonce nonce = new Nonce();
		if (oidcProvider.isCheckNonce()) {
			getSession(exchange).setAttribute(NONCE_KEY, nonce.getValue());
		}
		AuthenticationRequest authRequest = new AuthenticationRequest(oidcProvider.getAuthURI(), responseType, responseMode, scope, clientId, redirectURI, state, nonce, display, prompt, -1, null, null, null, null, null, oidcProvider.getClaims(), null, null, null, null);
		return authRequest.toURI().toString();
	} catch (Exception e) {
		LOG.log(Level.SEVERE, "", e);
		return null;
	}

}
 
開發者ID:aaronanderson,項目名稱:swarm-oidc,代碼行數:31,代碼來源:OIDCAuthenticationMechanism.java

示例6: responseModes

import com.nimbusds.oauth2.sdk.ResponseMode; //導入依賴的package包/類
private List<ResponseMode> responseModes() {
	return Arrays.asList(ResponseMode.QUERY, ResponseMode.FRAGMENT, ResponseMode.FORM_POST);
}
 
開發者ID:vpavic,項目名稱:simple-openid-provider,代碼行數:4,代碼來源:DiscoveryConfiguration.java


注:本文中的com.nimbusds.oauth2.sdk.ResponseMode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。