Author: chintana
Date: Fri Oct 30 11:27:38 2009
New Revision: 831269

URL: http://svn.apache.org/viewvc?rev=831269&view=rev
Log:
Hard coding the PPID value until we talk to the dataase and get the user from 
there. May be Identity Server user manager can be configured to get users from 
the existing MSSQL database?

Modified:
    
incubator/stonehenge/trunk/stocktrader/wsas/identity/org.wso2.carbon.identity.stonehenge.attributeservice/src/main/java/org/wso2/carbon/identity/stonehenge/attributeservice/StonehengeAttributeService.java

Modified: 
incubator/stonehenge/trunk/stocktrader/wsas/identity/org.wso2.carbon.identity.stonehenge.attributeservice/src/main/java/org/wso2/carbon/identity/stonehenge/attributeservice/StonehengeAttributeService.java
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/identity/org.wso2.carbon.identity.stonehenge.attributeservice/src/main/java/org/wso2/carbon/identity/stonehenge/attributeservice/StonehengeAttributeService.java?rev=831269&r1=831268&r2=831269&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/wsas/identity/org.wso2.carbon.identity.stonehenge.attributeservice/src/main/java/org/wso2/carbon/identity/stonehenge/attributeservice/StonehengeAttributeService.java
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/wsas/identity/org.wso2.carbon.identity.stonehenge.attributeservice/src/main/java/org/wso2/carbon/identity/stonehenge/attributeservice/StonehengeAttributeService.java
 Fri Oct 30 11:27:38 2009
@@ -45,37 +45,18 @@
 
         try {
             data = attrCallback.getData();
-            userIdentifier = data.getPrincipal().getName();            
-            password = 
getUserCredentials(MessageContext.getCurrentMessageContext().getEnvelope());    
        
-            log.info("User Identifier : " + userIdentifier);
-            log.info("User Password : " + password);
 
+            // we're cheating and hardcoding the ppid value.
+            // TODO: take it from the database
             if (RahasConstants.TOK_TYPE_SAML_20.equals(data.getTokenType())) {
-                if (attrCallback.getSAML2Attributes() != null
-                        || attrCallback.getSAML2Attributes().length > 0) {
-                    Attribute[] attributes = attrCallback.getSAML2Attributes();
-                    for (int i = 0; i < attributes.length; i++) {
-                        log.info(attributes[i].getName());
-                        // Overriding and filtering.
-                        if ("First Name".equals(attributes[i].getName())) {
-                            attributes[i].setName("New Name");
-                        }
-                    }
-                }
-                attrCallback.addAttributes(getSAML2Attribute("Custom 
Attribute", "Sample Value", "http://wso2.org/claims/customAttribute";));
+                
attrCallback.addAttributes(getSAML2Attribute("privatepersonalidentifier", 
"08C648FA-5C0E-4092-ABF8-E71785373CE8", 
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims";));
             } else {
-                // Retrieving all attribute values set before.
-                if (attrCallback.getAttributes() != null || 
attrCallback.getAttributes().length > 0) {
-                    SAMLAttribute[] attributes = attrCallback.getAttributes();
-                    for (int i = 0; i < attributes.length; i++) {
-                        log.info(attributes[i].toString());
-                        // Overriding and filtering.
-                        if ("First Name".equals(attributes[i].getName())) {
-                            attributes[i].setValues(Arrays.asList(new 
String[]{"New Name"}));
-                        }
-                    }
-                }
-            }
+            SAMLAttribute attribute = null;
+            attribute = new SAMLAttribute("privatepersonalidentifier",
+                    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims";, 
null, -1, Arrays
+                            .asList(new String[]{"uid:0"}));
+            attrCallback.addAttributes(attribute);
+            }            
         } catch (Exception e) {
             log.error("Error occuerd while populating claim data", e);
         }


Reply via email to