@Override public CredentialCreator newCreator(KapuaId scopeId) { return new CredentialCreatorImpl(scopeId); } }
/** * Constructor * * @param scopeId */ public CredentialQueryImpl(KapuaId scopeId) { this(); setScopeId(scopeId); } }
@Override public Credential newEntity(KapuaId scopeId) { return new CredentialImpl(scopeId); }
switch (credentialCreator.getCredentialType()) { case API_KEY: cryptedCredential = cryptApiKey(credentialCreator.getCredentialPlainKey()); break; case PASSWORD: default: cryptedCredential = cryptPassword(credentialCreator.getCredentialPlainKey()); break; CredentialImpl credentialImpl = new CredentialImpl(credentialCreator.getScopeId(), credentialCreator.getUserId(), credentialCreator.getCredentialType(),
public void onKapuaEvent(ServiceEvent kapuaEvent) throws KapuaException { if (kapuaEvent == null) { //service bus error. Throw some exception? } LOGGER.info("CredentialService: received kapua event from {}, operation {}", kapuaEvent.getService(), kapuaEvent.getOperation()); if ("user".equals(kapuaEvent.getService()) && "delete".equals(kapuaEvent.getOperation())) { deleteCredentialByUserId(kapuaEvent.getScopeId(), kapuaEvent.getEntityId()); } else if ("account".equals(kapuaEvent.getService()) && "delete".equals(kapuaEvent.getOperation())) { deleteCredentialByAccountId(kapuaEvent.getScopeId(), kapuaEvent.getEntityId()); } }
/** * Create credential creator for user with password. * * @param scopeId scopeId in which user is * @param userId userId for which credetntials are set * @param password open password as credetntials * @param status status of credentials enabled or disabled * @param expirationDate credential expiration date * @return credential creator used for creating credentials */ private CredentialCreator credentialCreatorCreator(KapuaId scopeId, KapuaId userId, String password, CredentialStatus status, Date expirationDate) { CredentialCreator credentialCreator; credentialCreator = new CredentialFactoryImpl().newCreator(scopeId, userId, CredentialType.PASSWORD, password, status, expirationDate); return credentialCreator; }
@Override public CredentialListResult newListResult() { return new CredentialListResultImpl(); }
@Override public CredentialQuery newQuery(KapuaId scopeId) { return new CredentialQueryImpl(scopeId); }
public void onKapuaEvent(ServiceEvent kapuaEvent) throws KapuaException { if (kapuaEvent == null) { //service bus error. Throw some exception? } LOGGER.info("CredentialService: received kapua event from {}, operation {}", kapuaEvent.getService(), kapuaEvent.getOperation()); if ("user".equals(kapuaEvent.getService()) && "delete".equals(kapuaEvent.getOperation())) { deleteCredentialByUserId(kapuaEvent.getScopeId(), kapuaEvent.getEntityId()); } else if ("account".equals(kapuaEvent.getService()) && "delete".equals(kapuaEvent.getOperation())) { deleteCredentialByAccountId(kapuaEvent.getScopeId(), kapuaEvent.getEntityId()); } }
@Override public CredentialCreator newCreator(KapuaId scopeId) { return new CredentialCreatorImpl(scopeId); } }
@Override public Credential newEntity(KapuaId scopeId) { return new CredentialImpl(scopeId); }
@Override public CredentialListResult newListResult() { return new CredentialListResultImpl(); }
/** * Constructor * * @param scopeId */ public CredentialQueryImpl(KapuaId scopeId) { this(); setScopeId(scopeId); } }
@Override public CredentialQuery newQuery(KapuaId scopeId) { return new CredentialQueryImpl(scopeId); }
@Override public CredentialCreatorImpl newCreator(KapuaId scopeId, KapuaId userId, CredentialType credentialType, String credentialKey, CredentialStatus credentialStatus, Date expirationDate) { return new CredentialCreatorImpl(scopeId, userId, credentialType, credentialKey, credentialStatus, expirationDate); }
@Override public Credential newCredential(KapuaId scopeId, KapuaId userId, CredentialType credentialType, String credentialKey, CredentialStatus credentialStatus, Date expirationDate) { return new CredentialImpl(scopeId, userId, credentialType, credentialKey, credentialStatus, expirationDate); }
/** * Return the credential list matching the provided query * * @param em * @param credentialQuery * @return * @throws KapuaException */ public static CredentialListResult query(EntityManager em, KapuaQuery<Credential> credentialQuery) throws KapuaException { return ServiceDAO.query(em, Credential.class, CredentialImpl.class, new CredentialListResultImpl(), credentialQuery); }
@Override public CredentialCreatorImpl newCreator(KapuaId scopeId, KapuaId userId, CredentialType credentialType, String credentialKey, CredentialStatus credentialStatus, Date expirationDate) { return new CredentialCreatorImpl(scopeId, userId, credentialType, credentialKey, credentialStatus, expirationDate); }
@Override public Credential newCredential(KapuaId scopeId, KapuaId userId, CredentialType credentialType, String credentialKey, CredentialStatus credentialStatus, Date expirationDate) { return new CredentialImpl(scopeId, userId, credentialType, credentialKey, credentialStatus, expirationDate); }
/** * Return the credential list matching the provided query * * @param em * @param credentialQuery * @return * @throws KapuaException */ public static CredentialListResult query(EntityManager em, KapuaQuery<Credential> credentialQuery) throws KapuaException { return ServiceDAO.query(em, Credential.class, CredentialImpl.class, new CredentialListResultImpl(), credentialQuery); }