/** * Create a PepRequest just using Strings * * <p>Note to developers: all the newPepRequest methods eventually call {@link * #newPEPRequest}({@link PepRequestOperation}), which * * @param subjectName String representing the name of the subject ex: Josh * @param actionId String representing the action ex: read * @param resourceId String representing the resource ex: file1234 * @return a PepRequest populated with attributes mapped from the params * @throws PepException Indicates that there is some issue creating the <code>PEPRequest</code> */ public PepRequest newPepRequest(String subjectName, String actionId, String resourceId) throws PepException { if (log.isTraceEnabled()) log.trace("Start Simple Decide"); PepRequest request = this.newPEPRequest(PepRequestOperation.DECIDE); request.setAccessSubject(subjectName); request.setResourceAction(resourceId, actionId); // request.setEnvironment(new Date()); return request; }
/** * Create a PepRequest using any set of objects for the Subject, Action, Resource, Environment * entities. * * <p>Note: for this PepRequest to work, the appropriate {@link JavaObjectMapper} classes must be * configured and set using {@link RequestAttributesFactoryImpl#setMappers(List)} * * @param subjectObj Object representing the Subject ex: javax.auth.security.Subject * @param actionObj Object representing the Action ex: String (read) * @param resourceObj Object representing the Resource ex: String (file) or File * @param environmentObj Object representing the Environment ex: Map containing attributes name * and values * @return a PepRequest populated with attributes mapped from params * @throws PepException if there is no <code>JavObjectMapper</code> configured for the objects * passed into the factory. * @see JavaObjectMapper */ public PepRequest newPepRequest( Object subjectObj, Object actionObj, Object resourceObj, Object environmentObj) throws PepException { if (log.isTraceEnabled()) log.trace("\n\tBegin creation of Mapper-based PepRequest"); PepRequest request = this.newPEPRequest(PepRequestOperation.DECIDE); request.setAccessSubject(subjectObj); request.setResourceAction(resourceObj, actionObj); request.setEnvironment(environmentObj); if (log.isTraceEnabled()) log.trace("\n\tCompleted creation of Mapper-based PepRequest"); return request; }