List of usage examples for org.springframework.security.acls.model NotFoundException NotFoundException
public NotFoundException(String msg)
NotFoundException
with the specified message. From source file:com.kylinolap.rest.service.AclService.java
@Override public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> oids, List<Sid> sids) throws NotFoundException { Map<ObjectIdentity, Acl> aclMaps = new HashMap<ObjectIdentity, Acl>(); HTableInterface htable = null;//from w w w . j a v a 2s. c om Result result = null; try { htable = HBaseConnection.get(hbaseUrl).getTable(aclTableName); for (ObjectIdentity oid : oids) { result = htable.get(new Get(Bytes.toBytes(String.valueOf(oid.getIdentifier())))); if (null != result && !result.isEmpty()) { SidInfo owner = sidSerializer.deserialize(result.getValue(Bytes.toBytes(ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_OWNER_COLUMN))); Sid ownerSid = (null == owner) ? null : (owner.isPrincipal() ? new PrincipalSid(owner.getSid()) : new GrantedAuthoritySid(owner.getSid())); boolean entriesInheriting = Bytes.toBoolean(result.getValue(Bytes.toBytes(ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_ENTRY_INHERIT_COLUMN))); Acl parentAcl = null; DomainObjectInfo parentInfo = domainObjSerializer.deserialize(result.getValue( Bytes.toBytes(ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_PARENT_COLUMN))); if (null != parentInfo) { ObjectIdentity parentObj = new ObjectIdentityImpl(parentInfo.getType(), parentInfo.getId()); parentAcl = readAclById(parentObj, null); } AclImpl acl = new AclImpl(oid, oid.getIdentifier(), aclAuthorizationStrategy, permissionGrantingStrategy, parentAcl, null, entriesInheriting, ownerSid); genAces(sids, result, acl); aclMaps.put(oid, acl); } else { throw new NotFoundException("Unable to find ACL information for object identity '" + oid + "'"); } } } catch (IOException e) { logger.error(e.getLocalizedMessage(), e); } finally { IOUtils.closeQuietly(htable); } return aclMaps; }
From source file:com.cedac.security.acls.mongo.MongoAclService.java
@Override public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids) throws NotFoundException { Map<ObjectIdentity, Acl> result = new HashMap<ObjectIdentity, Acl>(); for (ObjectIdentity oid : objects) { result.put(oid, readAclById(oid, sids)); }/* ww w . j a v a 2 s. c om*/ // Check every requested object identity was found (throw NotFoundException if needed) for (ObjectIdentity oid : objects) { if (!result.containsKey(oid)) { throw new NotFoundException("Unable to find ACL information for object identity '" + oid + "'"); } } return result; }
From source file:org.aon.esolutions.appconfig.web.controller.EnvironmentController.java
@RequestMapping(value = "/{environmentName}", method = RequestMethod.GET) @ResponseMapping("environmentDetails") public Environment getEnvironment(@PathVariable String applicationName, @PathVariable String environmentName) { Environment env = environmentRepository.getEnvironment(applicationName, environmentName); if (env == null) throw new NotFoundException("Can not find envioronment"); populatePrivateKey(env);/*from www . j ava 2s .com*/ RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); if (attributes != null) { attributes.setAttribute("allVariables", inheritanceUtil.getVariablesForEnvironment(env), RequestAttributes.SCOPE_REQUEST); if (usersAndRolesProvider != null) { attributes.setAttribute("availableUsers", usersAndRolesProvider.getAvailableUsers(), RequestAttributes.SCOPE_REQUEST); attributes.setAttribute("availableRoles", usersAndRolesProvider.getAvailableRoles(), RequestAttributes.SCOPE_REQUEST); } } return env; }
From source file:org.apache.kylin.rest.service.AclService.java
@Override public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> oids, List<Sid> sids) throws NotFoundException { Map<ObjectIdentity, Acl> aclMaps = new HashMap<ObjectIdentity, Acl>(); HTableInterface htable = null;//w ww .ja v a2s. c om Result result = null; try { htable = aclHBaseStorage.getTable(aclTableName); for (ObjectIdentity oid : oids) { result = htable.get(new Get(Bytes.toBytes(String.valueOf(oid.getIdentifier())))); if (null != result && !result.isEmpty()) { SidInfo owner = sidSerializer .deserialize(result.getValue(Bytes.toBytes(AclHBaseStorage.ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_OWNER_COLUMN))); Sid ownerSid = (null == owner) ? null : (owner.isPrincipal() ? new PrincipalSid(owner.getSid()) : new GrantedAuthoritySid(owner.getSid())); boolean entriesInheriting = Bytes .toBoolean(result.getValue(Bytes.toBytes(AclHBaseStorage.ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_ENTRY_INHERIT_COLUMN))); Acl parentAcl = null; DomainObjectInfo parentInfo = domainObjSerializer .deserialize(result.getValue(Bytes.toBytes(AclHBaseStorage.ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_PARENT_COLUMN))); if (null != parentInfo) { ObjectIdentity parentObj = new ObjectIdentityImpl(parentInfo.getType(), parentInfo.getId()); parentAcl = readAclById(parentObj, null); } AclImpl acl = new AclImpl(oid, oid.getIdentifier(), aclAuthorizationStrategy, permissionGrantingStrategy, parentAcl, null, entriesInheriting, ownerSid); genAces(sids, result, acl); aclMaps.put(oid, acl); } else { throw new NotFoundException("Unable to find ACL information for object identity '" + oid + "'"); } } } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { IOUtils.closeQuietly(htable); } return aclMaps; }
From source file:org.apache.kylin.rest.service.LegacyAclService.java
@Override public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> oids, List<Sid> sids) throws NotFoundException { Map<ObjectIdentity, Acl> aclMaps = new HashMap<ObjectIdentity, Acl>(); Table htable = null;//from ww w . j a va 2 s .c o m Result result = null; try { htable = aclHBaseStorage.getTable(aclTableName); for (ObjectIdentity oid : oids) { result = htable.get(new Get(Bytes.toBytes(String.valueOf(oid.getIdentifier())))); if (null != result && !result.isEmpty()) { SidInfo owner = sidSerializer .deserialize(result.getValue(Bytes.toBytes(AclHBaseStorage.ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_OWNER_COLUMN))); Sid ownerSid = (null == owner) ? null : (owner.isPrincipal() ? new PrincipalSid(owner.getSid()) : new GrantedAuthoritySid(owner.getSid())); boolean entriesInheriting = Bytes .toBoolean(result.getValue(Bytes.toBytes(AclHBaseStorage.ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_ENTRY_INHERIT_COLUMN))); Acl parentAcl = null; DomainObjectInfo parentInfo = domainObjSerializer .deserialize(result.getValue(Bytes.toBytes(AclHBaseStorage.ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_PARENT_COLUMN))); if (null != parentInfo) { ObjectIdentity parentObj = new ObjectIdentityImpl(parentInfo.getType(), parentInfo.getId()); parentAcl = readAclById(parentObj, null); } AclImpl acl = new AclImpl(oid, oid.getIdentifier(), aclAuthorizationStrategy, permissionGrantingStrategy, parentAcl, null, entriesInheriting, ownerSid); genAces(sids, result, acl); aclMaps.put(oid, acl); } else { throw new NotFoundException("Unable to find ACL information for object identity '" + oid + "'"); } } } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { IOUtils.closeQuietly(htable); } return aclMaps; }
From source file:org.ednovo.gooru.domain.service.storage.S3ServiceHandler.java
protected byte[] downloadSignedGetUrl(StorageArea storageArea, String subFolder, String fileName) throws Exception { if (subFolder == null || fileName == null || fileName.length() < 2) { throw new NotFoundException( "The specied Resource : " + storageArea.getAreaPath() + subFolder + fileName + DOESNOT_EXIST); }//from w ww . j a va2 s . co m RestS3Service restS3Service = initS3Service(storageArea.getStorageAccount()); subFolder = checkKey(true, subFolder); S3Object objectComplete = restS3Service.getObject(storageArea.getAreaName(), subFolder + fileName); return StreamUtils.getBytes(objectComplete.getDataInputStream()); }
From source file:org.ednovo.gooru.domain.service.storage.S3ServiceHandler.java
protected String getSignedGetUrl(StorageArea storageArea, String subFolder, String fileName, int timeToExpireInSecs) throws Exception { if (subFolder == null || fileName == null || fileName.length() < 2) { throw new NotFoundException( "The specied Resource : " + storageArea.getAreaPath() + subFolder + fileName + DOESNOT_EXIST); }// ww w . j a v a2s. c om RestS3Service restS3Service = initS3Service(storageArea.getStorageAccount()); subFolder = checkKey(true, subFolder); long time = new Date().getTime() + (timeToExpireInSecs * 1000); return restS3Service.createSignedGetUrl(storageArea.getAreaName(), subFolder + fileName, new Date(time)); }
From source file:org.springframework.security.acls.cassandra.CassandraAclService.java
public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids) throws NotFoundException { Assert.notEmpty(objects, "Objects to lookup required"); if (LOG.isDebugEnabled()) { LOG.debug("BEGIN readAclById: objectIdentities: " + objects + ", sids: " + sids); }//from ww w . j a v a 2s .c om // contains FULLY loaded Acl objects Map<ObjectIdentity, Acl> result = new HashMap<ObjectIdentity, Acl>(); List<ObjectIdentity> objectsToLookup = new ArrayList<ObjectIdentity>(objects); // Check for Acls in the cache if (aclCache != null) { for (ObjectIdentity oi : objects) { boolean aclLoaded = false; Acl acl = aclCache.getFromCache(oi); if (acl != null && acl.isSidLoaded(sids)) { // Ensure any cached element supports all the requested SIDs result.put(oi, acl); aclLoaded = true; } if (aclLoaded) { objectsToLookup.remove(oi); } } } if (!objectsToLookup.isEmpty()) { Map<ObjectIdentity, Acl> loadedAcls = doLookup(objectsToLookup); result.putAll(loadedAcls); // Put loaded Acls in the cache if (aclCache != null) { for (Acl loadedAcl : loadedAcls.values()) { aclCache.putInCache((AclImpl) loadedAcl); } } } for (ObjectIdentity oid : objects) { if (!result.containsKey(oid)) { throw new NotFoundException("Unable to find ACL information for object identity '" + oid + "'"); } } if (LOG.isDebugEnabled()) { LOG.debug("END readAclById: acls: " + result.values()); } return result; }
From source file:org.springframework.security.acls.jdbc.JdbcAclService.java
public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids) throws NotFoundException { Map<ObjectIdentity, Acl> result = lookupStrategy.readAclsById(objects, sids); // Check every requested object identity was found (throw NotFoundException if // needed)/*from w w w . ja va 2 s. c o m*/ for (ObjectIdentity oid : objects) { if (!result.containsKey(oid)) { throw new NotFoundException("Unable to find ACL information for object identity '" + oid + "'"); } } return result; }