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


Java ClientRegistrationResponse类代码示例

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


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

示例1: doPreExecute

import com.nimbusds.oauth2.sdk.client.ClientRegistrationResponse; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
    if (!super.doPreExecute(profileRequestContext)) {
        log.error("{} pre-execute failed", getLogPrefix());
        return false;
    }
    if (profileRequestContext.getOutboundMessageContext() == null) {
        log.error("{} Unable to locate outbound message context", getLogPrefix());
        ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
        return false;
    }
    Object message = profileRequestContext.getOutboundMessageContext().getMessage();

    if (message == null || !(message instanceof ClientRegistrationResponse)) {
        log.error("{} Unable to locate outbound message", getLogPrefix());
        ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
        return false;
    }
    response = (ClientRegistrationResponse) message;
    return true;
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:24,代码来源:BuildRegistrationResponse.java

示例2: getClientRegistrations

import com.nimbusds.oauth2.sdk.client.ClientRegistrationResponse; //导入依赖的package包/类
@GetMapping
public void getClientRegistrations(HttpServletRequest request, HttpServletResponse response) throws Exception {
	HTTPRequest httpRequest = ServletUtils.createHTTPRequest(request);

	try {
		String authorizationHeader = httpRequest.getAuthorization();

		if (authorizationHeader == null) {
			throw new GeneralException(BearerTokenError.INVALID_TOKEN);
		}

		BearerAccessToken requestAccessToken = BearerAccessToken.parse(authorizationHeader);
		validateAccessToken(requestAccessToken);
		List<OIDCClientInformation> clients = this.clientRepository.findAll();

		response.setContentType("application/json; charset=UTF-8");

		PrintWriter writer = response.getWriter();
		writer.print(toJsonObject(clients).toJSONString());
		writer.close();
	}
	catch (GeneralException e) {
		ClientRegistrationResponse registrationResponse = new ClientRegistrationErrorResponse(e.getErrorObject());
		ServletUtils.applyHTTPResponse(registrationResponse.toHTTPResponse(), response);
	}
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:27,代码来源:ClientRegistrationEndpoint.java

示例3: deleteClientConfiguration

import com.nimbusds.oauth2.sdk.client.ClientRegistrationResponse; //导入依赖的package包/类
@DeleteMapping(path = "/{id:.*}")
public void deleteClientConfiguration(HttpServletRequest request, HttpServletResponse response,
		@PathVariable ClientID id) throws IOException {
	HTTPRequest httpRequest = ServletUtils.createHTTPRequest(request);

	try {
		ClientDeleteRequest clientDeleteRequest = ClientDeleteRequest.parse(httpRequest);
		resolveAndValidateClient(id, clientDeleteRequest);

		this.clientRepository.deleteById(id);

		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
	}
	catch (GeneralException e) {
		ClientRegistrationResponse registrationResponse = new ClientRegistrationErrorResponse(e.getErrorObject());
		ServletUtils.applyHTTPResponse(registrationResponse.toHTTPResponse(), response);
	}
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:19,代码来源:ClientRegistrationEndpoint.java

示例4: registerClient

import com.nimbusds.oauth2.sdk.client.ClientRegistrationResponse; //导入依赖的package包/类
/**
	 * Client registration
	 * If the provider supports dynamic registration, a new client can be registered using the client registration process:
	 * 
	 * @param initialAccessToken the initial access token
	 * @throws SerializeException the serialize exception
	 * @throws IOException Signals that an I/O exception has occurred.
	 * @throws ParseException the parse exception
	 * @throws KeyStoreException
	 * @throws CertificateException
	 * @throws NoSuchAlgorithmException
	 * @throws KeyManagementException
	 */
	public void registerClient(BearerAccessToken initialAccessToken) throws SerializeException, IOException, ParseException, KeyManagementException, NoSuchAlgorithmException, CertificateException, KeyStoreException {

//		System.out.println("Client metadata");
//		System.out.println(metadata.toJSONObject());

		// Make registration request
		OIDCClientRegistrationRequest registrationRequest = new OIDCClientRegistrationRequest(providerMetadata.getRegistrationEndpointURI(), clientMetadata, initialAccessToken);
		HTTPResponse regHTTPResponse = registrationRequest.toHTTPRequest().send(null, Trust.getSocketFactory(trustStoreFile));

		// Parse and check response
		ClientRegistrationResponse registrationResponse = OIDCClientRegistrationResponseParser.parse(regHTTPResponse);

		if (registrationResponse instanceof ClientRegistrationErrorResponse) {
			ClientRegistrationErrorResponse errorResponse = ((ClientRegistrationErrorResponse) registrationResponse);
			ErrorObject error = errorResponse.getErrorObject();
			System.err.println(this.getClass().getSimpleName() + " - " + errorResponse.indicatesSuccess());
			System.err.println("Dynamic Client Registration failed, Error:");
			System.err.println(errorResponse);
			System.err.println(error);
			System.err.println(regHTTPResponse.getStatusCode());
			System.err.println(regHTTPResponse.getContent());
			System.err.println(regHTTPResponse.getWWWAuthenticate());
			System.err.println(regHTTPResponse.getLocation());
		} else {
			clientInformation = ((OIDCClientInformationResponse) registrationResponse).getOIDCClientInformation();
			clientID = clientInformation.getID();
		}
	}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:42,代码来源:SimpleOIDCClient.java


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