[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [Fwd: Retrieving subject attributes in EvaluationCtx objects]
Hello all I have been trying to retrieve a subject attribute value from a EvaluationCtx object for a couple days without a success. What I want to do is to write a method into my custom AttributeFinder module which in turns evaluates the subject attribute value in the original incoming request, and to retrieve the additional required attributes based on the identity of the subject. How can I retrieve subject attribute values from a given EvaluationCtx object? My Attribute Finder code is as follows: public EvaluationResult findAttribute(URI attributeType, URI attributeId, URI issuer, URI subjectCategory, EvaluationCtx context, int designatorType ){ if(!attributeType.toString().equals(StringAttribute.identifier)) return new EvaluationResult(BagAttribute.createEmptyBag(attributeType)); if(designatorType!=AttributeDesignator.SUBJECT_TARGET) return new EvaluationResult(BagAttribute.createEmptyBag(attributeType)); //This is the method to process incoming subject attrribute value String X509CaName=initiateTrustEvaluator(context); Set set=new HashSet(); set.add(new StringAttribute(X509CaName)); return new EvaluationResult(new BagAttribute(attributeType, set)); } public String initiateTrustEvaluator(EvaluationCtx context){ URI type = null; URI id = null; URL subjectGSH = null; String att = null; EvaluationResult evalResult = null; System.out.println("initiateTrustEvaluator"); try{ type = new URI(AnyURIAttribute.identifier); id = new URI("urn:oasis:names:tc:xacml:1.0:subject:subject-id"); }catch(java.net.URISyntaxException e){System.out.println(e);} evalResult=context.getSubjectAttribute(type,id,null); BagAttribute attr2 = (BagAttribute)(evalResult.getAttributeValue()); Iterator iter= attr2.iterator(); Subject subject=((Subject)(iter.next())); Set set = subject.getAttributes(); Iterator iter2= set.iterator(); System.out.println(((AnyURIAttribute)(iter2.next())).getValue()); /*the following piece of code worked for retrieveing resource attribute but not for the subject attribute value BagAttribute attr2 = (BagAttribute)(evalResult.getAttributeValue()); Iterator iter= attr2.iterator(); System.out.println(((AnyURIAttribute)(iter.next())).getValue()); */ ******************** This is my request builder code public Set setupSubjects(URI subjectLocation) throws URISyntaxException { // setup the id and value for the requesting subject URI subjectId = new URI("urn:oasis:names:tc:xacml:1.0:subject:subject-id"); AnyURIAttribute value = new AnyURIAttribute(subjectLocation); HashSet subjects = new HashSet(); HashSet attributes = new HashSet(); attributes.add(new Attribute(subjectId, null, null, value)); subjects.add(new Subject(null, attributes)); return subjects; } What am I doing wrong? I really appreciate your help. I almost finished my project however, got stuck in this one point... Thanks ...Mine -- Mine Altunay PhD student, Computer Engineering Dept, NC State Univ Phone: (919) 395 2789 E-Mail:maltuna@ncsu.edu
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]