Thanks, upgrade helped.
Rachana
From: Brent Putman
[mailto:] Sent: Thursday, May 08, 2008 2:09
PM To: Subject: Re:
[OpenSAML] Building AttributeType
Ok, then the link Chad sent you is irrelevant, your original code
with the AttributeType is what you want.
Sounds like you just have an
older version of the opensaml jar file. The XACML stuff was included in
the library only with the 2.1.0 release. Your opensaml jar should have
the following config files, if it doesn't, it's too old.
#: jar
tvf opensaml-2.1.0.jar | grep 'config\.xml' | cut -c
37-
saml1-assertion-config.xml saml1-core-validation-config.xml saml1-metadata-config.xml saml1-protocol-config.xml saml2-assertion-config.xml saml2-core-validation-config.xml saml2-metadata-config.xml saml2-metadata-query-config.xml saml2-metadata-validation-config.xml saml2-protocol-config.xml saml2-protocol-thirdparty-config.xml xacml10-saml2-profile-config.xml xacml11-saml2-profile-config.xml xacml2-saml2-profile-config.xml xacml20-context-config.xml xacml20-policy-config.xml xacml3-saml2-profile-config.xml
In
2.1.0 all of these, including the XACML ones, are loaded by the standard
DefaultBootstrap.bootstrap().
--Brent
Rachana
Ananthakrishnan wrote:
Hi,
Yes, Attribute builder is null and I am trying to
get an XACML attribute. I am able to get the following correctly,
so it is not all objects, might just be XACML namespace.
XSStringBuilder stringBuilder =
(XSStringBuilder)
builderFactory.getBuilder(XSString.TYPE_NAME);
Based on logs, I don't see any registration of builder
for Attribute Type. The following initialization code is in
place:
org.apache.xml.security.Init.init();
org.opensaml.DefaultBootstrap.bootstrap();
builderFactory = Configuration.getBuilderFactory();
The factory object gets initialized
correctly.
Looking at DefaultBootstrap.java, I don't see any
xacml*config files loaded for initialization and search for that in source
files yielded nothing. The config files are loaded in the OpenSAML jar. Any
idea where the xacml config files get loaded from and how I can add that to
the initialization?
Thanks,
Rachana
Are you saying
you're getting null from obtaining an Attribute builder from the builder
factory? Or for all objects? Or that you're getting an NPE
somewhere else?
Note that in the example on that page Chad sent,
the building of the Attribute isn't shown, you have to do that before you
call attribute.getAttributeValues(), just like any other XMLObject.
The purpose of the page is to show the use of the XSAny provider for
special cases.
However, in your original question, you used an
AttributeType, which the provider interface for a XACML attribute.
Is that what you wanted, or did you want SAML
Attribute?
--Brent
Rachana Ananthakrishnan wrote:
Thanks, that seems applicable only to the AttributeValue to add. I have that
fixed to use builder of the type.
But, in the example on that webpage, how is this built?
// Normally built Attribute object
Attribute attribute;
The NPE I am seeing is with building the Attribute object, not the
AttributeValue.
If there are samples I should look at, I would appreciate a pointer.
Thanks,
Rachana
-----Original Message-----
From: Chad La Joie []
Sent: Thursday, May 08, 2008 9:46 AM
To:
Subject: Re: [OpenSAML] Building AttributeType
https://spaces.internet2.edu/display/OpenSAML/OSTwoUsrManJavaAnyTypes
Rachana Ananthakrishnan wrote:
Hi,
I have the following code to create attributes with some
string value, but
end up with AttributeTypeImplBuilder ends up being null.
Here are relevant code snippets:
import org.opensaml.Configuration;
static XMLObjectBuilderFactory builderFactory;
static {
try {
org.opensaml.DefaultBootstrap.bootstrap();
} catch (Exception e) {
// FIXME: handle exception better
System.err.println(e);
}
builderFactory = Configuration.getBuilderFactory();
System.out.println("Builder factory " +
(builderFactory == null));
}
// attribute builder is null here.
AttributeTypeImplBuilder attributeBuilder =
(AttributeTypeImplBuilder)
builderFactory.getBuilder(AttributeType.DEFAULT_ELEMENT_NAME);
Is there any additional initialization that is required?
Thanks,
Rachana
--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Security
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
, http://www.switch.ch
|