@Test public void updateKeyFriendlyName() throws Exception { KeyInfo keyInfo = keyService.getKey(AUTH_KEY_ID); assertEquals("friendly-name", keyInfo.getFriendlyName()); keyInfo = keyService.updateKeyFriendlyName(AUTH_KEY_ID, "new-friendly-name"); assertEquals("new-friendly-name", keyInfo.getFriendlyName()); }
public KeyInfo updateKeyFriendlyName(String id, String friendlyName) throws KeyNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = tokenService.getTokenForKeyId(id); KeyInfo keyInfo = getKey(tokenInfo, id); auditDataHelper.put(KEY_ID, keyInfo.getId()); auditDataHelper.put(KEY_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleKeyAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo, keyInfo); try { signerProxyFacade.setKeyFriendlyName(id, friendlyName); keyInfo = getKey(id); } catch (KeyNotFoundException e) { throw e; } catch (CodedException e) { if (isCausedByKeyNotFound(e)) { throw new KeyNotFoundException(e); } else { throw e; } } catch (Exception e) { throw new SignerNotReachableException("Update key friendly name failed", e); } return keyInfo; }
KeyService { public KeyInfo updateKeyFriendlyName(String id, String friendlyName) throws KeyNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = tokenService.getTokenForKeyId(id); KeyInfo keyInfo = getKey(tokenInfo, id); auditDataHelper.put(KEY_ID, keyInfo.getId()); auditDataHelper.put(KEY_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleKeyAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo, keyInfo); try { signerProxyFacade.setKeyFriendlyName(id, friendlyName); keyInfo = getKey(id); } catch (KeyNotFoundException e) { throw e; } catch (CodedException e) { if (isCausedByKeyNotFound(e)) { throw new KeyNotFoundException(e); } else { throw e; } } catch (Exception e) { throw new SignerNotReachableException("Update key friendly name failed", e); } return keyInfo; } }
KeyService { public KeyInfo updateKeyFriendlyName(String id, String friendlyName) throws KeyNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = tokenService.getTokenForKeyId(id); KeyInfo keyInfo = getKey(tokenInfo, id); auditDataHelper.put(KEY_ID, keyInfo.getId()); auditDataHelper.put(KEY_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleKeyAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo, keyInfo); try { signerProxyFacade.setKeyFriendlyName(id, friendlyName); keyInfo = getKey(id); } catch (KeyNotFoundException e) { throw e; } catch (CodedException e) { if (isCausedByKeyNotFound(e)) { throw new KeyNotFoundException(e); } else { throw e; } } catch (Exception e) { throw new SignerNotReachableException("Update key friendly name failed", e); } return keyInfo; } @Autowired  KeyService(TokenService tokenService, SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            ManagementRequestSenderService managementRequestSenderService,
            SecurityHelper securityHelper,
            AuditDataHelper auditDataHelper,
            AuditEventHelper auditEventHelper,
            AuditEventLoggingFacade auditEventLoggingFacade); }
KeyService { public KeyInfo updateKeyFriendlyName(String id, String friendlyName) throws KeyNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = tokenService.getTokenForKeyId(id); KeyInfo keyInfo = getKey(tokenInfo, id); auditDataHelper.put(KEY_ID, keyInfo.getId()); auditDataHelper.put(KEY_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleKeyAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo, keyInfo); try { signerProxyFacade.setKeyFriendlyName(id, friendlyName); keyInfo = getKey(id); } catch (KeyNotFoundException e) { throw e; } catch (CodedException e) { if (isCausedByKeyNotFound(e)) { throw new KeyNotFoundException(e); } else { throw e; } } catch (Exception e) { throw new SignerNotReachableException("Update key friendly name failed", e); } return keyInfo; } @Autowired  KeyService(TokenService tokenService, SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            ManagementRequestSenderService managementRequestSenderService,
            SecurityHelper securityHelper,
            AuditDataHelper auditDataHelper,
            AuditEventHelper auditEventHelper,
            AuditEventLoggingFacade auditEventLoggingFacade); KeyInfo getKey(String keyId); KeyInfo getKey(TokenInfo tokenInfo, String keyId); KeyInfo updateKeyFriendlyName(String id, String friendlyName); KeyInfo addKey(String tokenId, String keyLabel); void deleteKeyAndIgnoreWarnings(String keyId); void deleteKey(String keyId, Boolean ignoreWarnings); EnumSet<PossibleActionEnum> getPossibleActionsForKey(String keyId); }
KeyService { public KeyInfo updateKeyFriendlyName(String id, String friendlyName) throws KeyNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = tokenService.getTokenForKeyId(id); KeyInfo keyInfo = getKey(tokenInfo, id); auditDataHelper.put(KEY_ID, keyInfo.getId()); auditDataHelper.put(KEY_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleKeyAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo, keyInfo); try { signerProxyFacade.setKeyFriendlyName(id, friendlyName); keyInfo = getKey(id); } catch (KeyNotFoundException e) { throw e; } catch (CodedException e) { if (isCausedByKeyNotFound(e)) { throw new KeyNotFoundException(e); } else { throw e; } } catch (Exception e) { throw new SignerNotReachableException("Update key friendly name failed", e); } return keyInfo; } @Autowired  KeyService(TokenService tokenService, SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            ManagementRequestSenderService managementRequestSenderService,
            SecurityHelper securityHelper,
            AuditDataHelper auditDataHelper,
            AuditEventHelper auditEventHelper,
            AuditEventLoggingFacade auditEventLoggingFacade); KeyInfo getKey(String keyId); KeyInfo getKey(TokenInfo tokenInfo, String keyId); KeyInfo updateKeyFriendlyName(String id, String friendlyName); KeyInfo addKey(String tokenId, String keyLabel); void deleteKeyAndIgnoreWarnings(String keyId); void deleteKey(String keyId, Boolean ignoreWarnings); EnumSet<PossibleActionEnum> getPossibleActionsForKey(String keyId); static final String WARNING_AUTH_KEY_REGISTERED_CERT_DETECTED; }