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


Java NoSuchClientException类代码示例

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


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

示例1: loadClientByClientId

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
  Client client = this.clientRepository.findByClientId(clientId);

  if (client == null) {
    throw new NoSuchClientException(String.format("No client with requested id: %s", clientId));
  }

  BaseClientDetails baseClientDetails = new BaseClientDetails();
  baseClientDetails.setClientId(client.getClientId());
  baseClientDetails.setClientSecret(client.getClientSecret());
  baseClientDetails.setResourceIds(StringUtils.commaDelimitedListToSet(client.getResourceIds()));
  baseClientDetails.setScope(StringUtils.commaDelimitedListToSet(client.getScopes()));
  baseClientDetails.setAuthorizedGrantTypes(StringUtils.commaDelimitedListToSet(client.getGrantTypes()));
  baseClientDetails.setRegisteredRedirectUri(StringUtils.commaDelimitedListToSet(client.getRedirectUris()));
  baseClientDetails.setAutoApproveScopes(StringUtils.commaDelimitedListToSet(client.getAutoApproveScopes()));
  return baseClientDetails;
}
 
开发者ID:brahalla,项目名称:oauth2,代码行数:19,代码来源:ClientDetailsServiceImpl.java

示例2: loadClientByClientId

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
    
    if (clientId.equals(id))
    {
        List<String> authorizedGrantTypes = new ArrayList<String>();
        authorizedGrantTypes.add("password");
        authorizedGrantTypes.add("refresh_token");
        authorizedGrantTypes.add("client_credentials");
 
        BaseClientDetails clientDetails = new BaseClientDetails();
        clientDetails.setClientId(id);
        clientDetails.setClientSecret(secretKey);
        clientDetails.setAuthorizedGrantTypes(authorizedGrantTypes);
         
        return clientDetails;
    }
    else {
        throw new NoSuchClientException("No client recognized with id: "
                + clientId);
    }
    
}
 
开发者ID:hcadavid,项目名称:spring4-rest-oauth2,代码行数:24,代码来源:AAAGuestServiceImpl.java

示例3: updateClientDetails

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public void updateClientDetails(ClientDetails clientDetails) throws NoSuchClientException {
	final MongoClientDetails mongoClientDetails = new MongoClientDetails(clientDetails.getClientId(),
			clientDetails.getClientSecret(),
			clientDetails.getScope(),
			clientDetails.getResourceIds(),
			clientDetails.getAuthorizedGrantTypes(),
			clientDetails.getRegisteredRedirectUri(),
			newArrayList(clientDetails.getAuthorities()),
			clientDetails.getAccessTokenValiditySeconds(),
			clientDetails.getRefreshTokenValiditySeconds(),
			clientDetails.getAdditionalInformation(),
			getAutoApproveScopes(clientDetails));
	final boolean result = mongoClientDetailsRepository.update(mongoClientDetails);

	if (!result) {
		throw new NoSuchClientException("No such Client Id");
	}
}
 
开发者ID:cloudade,项目名称:authorization-server-with-mongodb,代码行数:20,代码来源:MongoClientDetailsService.java

示例4: loadClientByClientId

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public ClientDetails loadClientByClientId(String clientId)
		throws ClientRegistrationException {
	if(clientId.equals("353b302c44574f565045687e534e7d6a")){
		 
		List<String> authorizedGrantTypes = new ArrayList<String>();
		authorizedGrantTypes.add("password");
		authorizedGrantTypes.add("refresh_token");
		
		BaseClientDetails clientDetails = new BaseClientDetails();
		clientDetails.setClientId("353b302c44574f565045687e534e7d6a");
		clientDetails.setClientSecret("286924697e615a672a646a493545646c");
		clientDetails.setAuthorizedGrantTypes(authorizedGrantTypes);
		List<String> list = new ArrayList<String>();
		list.add("read");
		list.add("write");
		clientDetails.setScope(list);
		return clientDetails;
	}else{
		throw new NoSuchClientException("No client with requested id:");
	}
 
}
 
开发者ID:xxing1982,项目名称:EDU_SYZT,代码行数:24,代码来源:ClientDetailsServiceImpl.java

示例5: shouldUpdateClientSecret

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Test
public void shouldUpdateClientSecret() throws NoSuchClientException {
    //Given
    final String clientId = string().next();
    final String secret = string().next();

    //And
    final String expectedNewSecret = string().next();
    given(passwordEncoder.encode(secret)).willReturn(expectedNewSecret);

    //And
    given(mongoClientDetailsRepository.updateClientSecret(clientId, expectedNewSecret)).willReturn(true);

    //When
    mongoClientDetailsService.updateClientSecret(clientId, secret);
}
 
开发者ID:caelwinner,项目名称:spring-security-mongo,代码行数:17,代码来源:MongoClientDetailsServiceTest.java

示例6: shouldNotUpdateClientSecretWhenClientIdIsInvalid

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Test(expected = NoSuchClientException.class)
public void shouldNotUpdateClientSecretWhenClientIdIsInvalid() throws NoSuchClientException {
    //Given
    final String clientId = string().next();
    final String secret = string().next();

    //And
    final String expectedNewSecret = string().next();
    given(passwordEncoder.encode(secret)).willReturn(expectedNewSecret);

    //And
    given(mongoClientDetailsRepository.updateClientSecret(clientId, expectedNewSecret)).willReturn(false);

    //When
    mongoClientDetailsService.updateClientSecret(clientId, secret);
}
 
开发者ID:caelwinner,项目名称:spring-security-mongo,代码行数:17,代码来源:MongoClientDetailsServiceTest.java

示例7: loadClientByClientId

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public ClientDetails loadClientByClientId(String clientId)
        throws OAuth2Exception {

    if (clientId.equals(id))
    {
        List<String> authorizedGrantTypes = new ArrayList<String>();
        authorizedGrantTypes.add("password");
        authorizedGrantTypes.add("refresh_token");
        authorizedGrantTypes.add("client_credentials");

        BaseClientDetails clientDetails = new BaseClientDetails();
        clientDetails.setClientId(id);
        clientDetails.setClientSecret(secretKey);
        clientDetails.setAuthorizedGrantTypes(authorizedGrantTypes);

        return clientDetails;
    }
    else {
        throw new NoSuchClientException("No client recognized with id: "
                + clientId);
    }
}
 
开发者ID:NCIP,项目名称:national-biomedical-image-archive,代码行数:24,代码来源:ClientDetailServiceImpl.java

示例8: delete

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@RequestMapping(path = "/_remove/{clientId}", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                                                       MediaType.APPLICATION_XHTML_XML_VALUE })
public String delete(@PathVariable("clientId") String clientId, RedirectAttributes attributes) {

    try {
        clientDetailsService.removeClientDetails(clientId);
    } catch (NoSuchClientException e) {
        addWarningMessage(attributes, "没有找到客户端ID " + clientId + " 对应的客户端。");
    }

    return "redirect:/clientDetails.html";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:13,代码来源:ClientDetailsAdminController.java

示例9: updateClientSecret

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Transactional
@Override
public void updateClientSecret(String clientId, String secret) throws NoSuchClientException {
    ClientDetailsEntity clientDetailsEntity = clientDetailsRepository.findOneByClientId(clientId).<NoSuchClientException> orElseThrow(() -> new NoSuchClientException("Client id not found."));

    clientDetailsEntity.setClientSecret(passwordEncoder.encode(secret));

    clientDetailsRepository.save(clientDetailsEntity);
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:10,代码来源:OAuth2DatabaseClientDetailsService.java

示例10: loadClientByClientId

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
    ClientDetails details = clientDetails.get(clientId);
    if (details == null) {
      throw new NoSuchClientException("No client with requested id: " + clientId);
    }
    return details;
  }
 
开发者ID:SeldonIO,项目名称:seldon-core,代码行数:9,代码来源:InMemoryClientDetailsService.java

示例11: loadClientByClientId

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public org.springframework.security.oauth2.provider.ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
    try {
        Client client = clientService.findByDomainAndClientId(domain.getId(), clientId);

        if (client != null && client.isEnabled()) {
            return new DelegateClientDetails(client);
        }
    } catch (ClientNotFoundException ignored) {
    }

    throw new NoSuchClientException("No client with requested id: " + clientId);
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:14,代码来源:DomainBasedClientDetailsService.java

示例12: deactivate

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public Plugin deactivate(Plugin plugin) {
    try {
        clientRegistrationService.removeClientDetails(plugin.getIdentifier());
    } catch (NoSuchClientException exception) {
        // ignore, remove silently
    }
    return plugin;
}
 
开发者ID:OwnYourData,项目名称:oyd-pia,代码行数:10,代码来源:PluginRepositoryImpl.java

示例13: updateClientSecret

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public void updateClientSecret(String clientId, String secret) throws NoSuchClientException {
	final boolean result = mongoClientDetailsRepository.updateClientSecret(clientId, passwordEncoder.encode(secret));
	if (!result) {
		throw new NoSuchClientException("No such client id");
	}
}
 
开发者ID:cloudade,项目名称:authorization-server-with-mongodb,代码行数:8,代码来源:MongoClientDetailsService.java

示例14: removeClientDetails

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public void removeClientDetails(String clientId) throws NoSuchClientException {
	final boolean result = mongoClientDetailsRepository.deleteByClientId(clientId);
	if (!result) {
		throw new NoSuchClientException("No such client id");
	}
}
 
开发者ID:cloudade,项目名称:authorization-server-with-mongodb,代码行数:8,代码来源:MongoClientDetailsService.java

示例15: loadClientByClientId

import org.springframework.security.oauth2.provider.NoSuchClientException; //导入依赖的package包/类
@Override
public ClientDetails loadClientByClientId(final String clientId) {
    ClientEntity client = clientRepository.findById(clientId);
    if (client == null) {
        throw new NoSuchClientException(String.format(
                "OsiamClientDetailsService failed to load client with id %s: no client found",
                clientId
        ));
    }
    return client;
}
 
开发者ID:osiam,项目名称:osiam,代码行数:12,代码来源:OsiamClientDetailsService.java


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