Author: prabath
Date: Fri Jan 11 12:22:21 2008
New Revision: 12157
Log:
removed hard-coded values
Modified:
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/sts/OpenIDTokenIssuer.java
Modified:
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/sts/OpenIDTokenIssuer.java
==============================================================================
---
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/sts/OpenIDTokenIssuer.java
(original)
+++
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/sts/OpenIDTokenIssuer.java
Fri Jan 11 12:22:21 2008
@@ -17,10 +17,17 @@
import org.apache.rahas.TrustUtil;
import org.apache.ws.security.message.WSSecEncryptedKey;
import org.apache.ws.security.util.XmlSchemaDateFormat;
+import org.openid4java.association.Association;
+import org.openid4java.association.AssociationException;
+import org.openid4java.consumer.InMemoryConsumerAssociationStore;
import org.openid4java.message.Message;
import org.openid4java.message.MessageException;
import org.openid4java.message.Parameter;
import org.openid4java.message.ParameterList;
+import org.openid4java.server.InMemoryServerAssociationStore;
+import org.openid4java.server.IncrementalNonceGenerator;
+import org.openid4java.server.NonceGenerator;
+import org.openid4java.server.ServerAssociationStore;
import org.opensaml.SAMLAssertion;
import org.opensaml.SAMLException;
@@ -35,6 +42,18 @@
public class OpenIDTokenIssuer extends IdentityTokenIssuer {
+ private String appliesTo;
+
+ /**
+ *
+ */
+ public SOAPEnvelope issue(RahasData data) throws TrustException {
+
+ appliesTo = data.getAppliesToAddress();
+
+ return super.issue(data);
+ }
+
/**
*
*/
@@ -129,6 +148,13 @@
OpenIDInfoCardToken token = null;
Message message = null;
ParameterList params = null;
+ String claimID = null;
+ Association assoc = null;
+ String nonce = null;
+
+ claimID = ((RequestedClaimData) ipData.requestedClaims
+ .get(IdentityConstants.CLAIM_OPENID)).value;
+ nonce = OpenIDProvider.getNonce();
params = new ParameterList();
@@ -139,30 +165,39 @@
OpenIDProvider.getOpAddress()));
params.set(new Parameter(IdentityConstants.OpenId.ATTR_CLAIM_ID,
- ((RequestedClaimData) ipData.requestedClaims
- .get(IdentityConstants.CLAIM_OPENID)).value));
+ claimID));
params.set(new Parameter(IdentityConstants.OpenId.ATTR_RESPONSE_NONCE,
- "2007-12-14T09:25:50Z0"));
+ nonce));
params.set(new Parameter(IdentityConstants.OpenId.ATTR_MODE,
"id_res"));
params.set(new Parameter(IdentityConstants.OpenId.ATTR_IDENTITY,
- ((RequestedClaimData) ipData.requestedClaims
- .get(IdentityConstants.CLAIM_OPENID)).value));
+ claimID));
- // TODO: remove hard-coded string.
params.set(new Parameter(IdentityConstants.OpenId.ATTR_RETURN_TO,
- "https://localhost:12443/OpenIdInfoCardLogin.action"));
+ appliesTo));
+
+ try {
+ assoc = OpenIDProvider.getAssocHandle();
+ params.set(new Parameter(
+ IdentityConstants.OpenId.ATTR_ASSOC_HANDLE, assoc
+ .getHandle()));
+ } catch (AssociationException e) {
+ throw new MessageException(e.getMessage());
+ }
- params.set(new Parameter(IdentityConstants.OpenId.ATTR_ASSOC_HANDLE,
- "e242741d76b42a6"));
params
.set(new Parameter(IdentityConstants.OpenId.ATTR_SIGNED,
"op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle"));
- params.set(new Parameter(IdentityConstants.OpenId.ATTR_SIG,
- "ug3AMXHi6fnBDNk1ey0TyP+GI5o="));
+ try {
+ params.set(new Parameter(IdentityConstants.OpenId.ATTR_SIG,
+ OpenIDProvider.getSignature(OpenIDProvider.getOpAddress(),
+ claimID, false, appliesTo, nonce, assoc)));
+ } catch (AssociationException e) {
+ throw new MessageException(e.getMessage());
+ }
params.set(new Parameter(
IdentityConstants.OpenId.ExchangeAttributes.EXT,
@@ -236,11 +271,10 @@
if (ipData.requestedClaims
.containsKey(IdentityProviderConstants.ATTR_NS_CITY)) {
- params
- .set(new Parameter(
- IdentityConstants.OpenId.ExchangeAttributes.TYPE
- +
IdentityConstants.OpenId.ExchangeAttributes.CITY,
-
IdentityConstants.OpenId.ExchangeAttributes.CITY_NS));
+ params.set(new Parameter(
+ IdentityConstants.OpenId.ExchangeAttributes.TYPE
+ + IdentityConstants.OpenId.ExchangeAttributes.CITY,
+ IdentityConstants.OpenId.ExchangeAttributes.CITY_NS));
params
.set(new Parameter(
IdentityConstants.OpenId.ExchangeAttributes.VALUE
_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev