Examples of KeyService


Examples of com.github.ebnew.ki4so.core.key.KeyService

        key.setKeyId(keyId);
       
        Mockito.when(appService.findKi4soServerApp()).thenReturn(app);
        Mockito.when(appService.findAppByHost(service)).thenReturn(clientApp);
        
        KeyService keyService = Mockito.mock(KeyService.class);
        Mockito.when(keyService.findKeyByAppId(appId)).thenReturn(key);
        Mockito.when(keyService.findKeyByAppId(app2Id)).thenReturn(key);
       
        this.handler.setKeyService(keyService);
        EncryCredentialManager encryCredentialManager = Mockito.mock(EncryCredentialManager.class);
        Mockito.when(encryCredentialManager.encrypt(Mockito.any(EncryCredentialInfo.class))).thenReturn(encStringValue);
        this.handler.setEncryCredentialManager(encryCredentialManager);
View Full Code Here

Examples of com.github.ebnew.ki4so.core.key.KeyService

  public void tearDown() throws Exception {
  }
 
  @Test
  public void testFetchKey() throws UnsupportedEncodingException {
    KeyService keyService = Mockito.mock(KeyService.class);
    Ki4soKey ki4soKey = Mockito.mock(Ki4soKey.class);
    Mockito.when(keyService.findKeyByAppId(Mockito.anyString())).thenReturn(ki4soKey);
    keyAction.setKeyService(keyService);
    Ki4soKey result = keyAction.fetchKey("100");
    Assert.assertTrue(ki4soKey==result);
  }
View Full Code Here

Examples of com.github.ebnew.ki4so.core.key.KeyService

   
    /**
     * 测试传入的参数不合法的情况。
     */
    EncryCredentialInfo encryCredentialInfo = new EncryCredentialInfo();
    KeyService keyService = Mockito.mock(KeyService.class);
    encryCredentialManager.setKeyService(keyService);
    String result = encryCredentialManager.encrypt(encryCredentialInfo);
    checkData(result, encryCredentialInfo);
   
   
    /**
     * 设置模拟服务,查询到的key为null.
     */
    result = encryCredentialManager.encrypt(encryCredentialInfo);
    checkData(result, encryCredentialInfo);
   
    /**
     * 设置模拟服务,查询到的key不是null.
     */
    String keyId = "1001";
    Ki4soKey key = new Ki4soKey();
    key.setKeyId(keyId);
    key.setValue("dafdasfdasfds");
    encryCredentialInfo.setKeyId(keyId);
    Mockito.when(keyService.findKeyByKeyId(keyId)).thenReturn(key);
    result = encryCredentialManager.encrypt(encryCredentialInfo);
    checkData(result, encryCredentialInfo);
 
    /**
     * 测试正常的情况。
 
View Full Code Here

Examples of org.wildfly.extension.picketlink.federation.service.KeyService

    static void launchServices(OperationContext context, PathAddress pathAddress, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
        String federationAlias = pathAddress.subAddress(0, pathAddress.size() - 2).getLastElement().getValue();
        String keyName = pathAddress.getLastElement().getValue();
        String host = KeyResourceDefinition.HOST.resolveModelAttribute(context, model).asString();
        KeyService service = new KeyService(keyName, host);
        ServiceBuilder<KeyService> serviceBuilder = context.getServiceTarget().addService(KeyService.createServiceName(federationAlias, keyName), service);

        serviceBuilder.addDependency(KeyStoreProviderService.createServiceName(federationAlias), KeyStoreProviderService.class, service.getKeyStoreProviderService());

        if (verificationHandler != null) {
            serviceBuilder.addListener(verificationHandler);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.