@Override public Response invoke(Request request) { IdentityController idm = IdentityController.getInstance(); List<Identity> users = idm.readAll(); if(users == null || users.isEmpty()) { return null; } List<String> usernames = new ArrayList<String>(); for(Identity local:users) { usernames.add(local.getPrincipal()); } Response response = new Response(); response.setListAttribute("users", usernames); return response; } }
private void prepareResponse(Identity identity, Response response) { this.prepareResponse(response); //Get AuthenticationHash for the device response.setAttribute("authenticationHash", identity.getCredential()); }
public void activate(String principal) throws IDMException { if(principal == null || principal.trim().length()==0) { throw new IllegalStateException("Principal should not be null!!"); } Identity identity = this.identityController.read(principal); if(identity == null) { throw new IDMException(IDMException.IDENITITY_NOT_FOUND); } identity.activate(); this.identityController.update(identity); }
public void activate() { IdentityAttribute active = this.readAttribute("active"); if(active == null) { active = new IdentityAttribute("active", Boolean.TRUE.toString()); this.addAttribute(active); } else { active.setValue(Boolean.TRUE.toString()); this.updateAttribute(active); } }
public void updateAttribute(IdentityAttribute attribute) { IdentityAttribute cour = this.find(attribute); if(cour != null) { cour.setName(attribute.getName()); cour.setValue(attribute.getValue()); } else { this.addAttribute(attribute); } }
String authenticationHash = Utilities.generateOneWayHash(newpassword, identity.getPrincipal()+newpassword); identity.setInactiveCredential(newpassword); identity.setCredential(authenticationHash); this.identityController.update(identity);
Identity identity = new Identity(); identity.setPrincipal(email); identity.setCredential(authenticationHash); identity.addAttribute(new IdentityAttribute("email", email)); identity.setInactiveCredential(credential); identity.activate(); Group standardGroup = this.groupController.read("standard"); identity.getGroups().add(standardGroup);
if(activationCredential == null || !activationCredential.equals(registeredIdentity.getInactiveCredential())) device.addAttribute(new DeviceAttribute("nonce", registeredIdentity.getCredential())); device.updateAttribute(new DeviceAttribute("nonce", registeredIdentity.getCredential())); this.deviceController.update(device);
for(Device device:localCopy) if(!device.getIdentity().isActive())
public void deactivate() { IdentityAttribute active = this.readAttribute("active"); if(active == null) { active = new IdentityAttribute("active", Boolean.FALSE.toString()); this.addAttribute(active); } else { active.setValue(Boolean.FALSE.toString()); this.updateAttribute(active); } }
if(device != null && device.getIdentity().isActive())
if(cour.getPrincipal().equals(member))
for(Identity cour: group.getMembers()) if(cour.getPrincipal().equals(member))
public Response invoke(Request request) { try { Response response = new Response(); List<Identity> identities = this.provisioner.getIdentityController().readAll(); if(identities != null && !identities.isEmpty()) { List<String> users = new ArrayList<String>(); for(Identity identity:identities) { users.add(identity.getPrincipal()); } response.setListAttribute("users", users); } return response; } catch(IDMException idmError) { Response response = new Response(); response.setAttribute("idm-error", idmError.getMessage()); response.setAttribute("idm-error-type", ""+idmError.getType()); return response; } } }
log.debug("User: "+registeredUser.getPrincipal()); Set<Device> allDevices = deviceController.readByIdentity(registeredUser.getPrincipal()); if(allDevices == null || allDevices.isEmpty())
private void addSession(Device device) { CometSession session = this.findCometSession(device.getIdentifier()); if(session != null) { //Checking to make sure multiple device sessions are not created //resulting in multiple Bus infrastructure for each device return; } Subscription subscription = new Subscription(); subscription.setClientId(device.getIdentifier()); subscription.setConfigValue("identity", device.getIdentity().getPrincipal()); CometSession deviceSession = CometSession.createInstance(subscription); deviceSession.start(); this.cometSessions.add(deviceSession); } //---------------------------------------------------------------------------------------------------------
cour.setDeviceId(device.getIdentifier()); cour.setUpdateType(ChannelUpdateType.ADD); cour.setPrincipal(identity.getPrincipal()); allUpdates.add(cour); cour.setDeviceId(device.getIdentifier()); cour.setUpdateType(ChannelUpdateType.REPLACE); cour.setPrincipal(identity.getPrincipal()); allUpdates.add(cour); cour.setDeviceId(device.getIdentifier()); cour.setUpdateType(ChannelUpdateType.DELETE); cour.setPrincipal(identity.getPrincipal()); allUpdates.add(cour); ",Identity:"+device.getIdentity().getPrincipal()+"Channel: "+this.channelRegistration.getUri()+ "Scan Time: "+dateFormat.format(new Date()));