Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wso2/product-is
Browse files Browse the repository at this point in the history
Conflicts:
	modules/p2-profile-gen/pom.xml
  • Loading branch information
hpmtissera committed Jul 22, 2015
2 parents c6dc28b + 9dbd945 commit 2488453
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void testAddSP() throws Exception {
SAMLSSOServiceProviderDTO[] samlssoServiceProviderDTOs = ssoConfigServiceClient
.getServiceProviders().getServiceProviders();
Assert.assertEquals(samlssoServiceProviderDTOs[0].getIssuer(), config.getApp().getArtifact(),
"Adding a service provider has failed for " + config);
"Adding a service provider has failed for " + config);
}

@Test(description = "Remove service provider", groups = "wso2.is", dependsOnMethods = { "testSAMLSSOLogout" })
Expand All @@ -295,7 +295,7 @@ public void testRemoveSP()
}

@Test(alwaysRun = true, description = "Testing SAML SSO login", groups = "wso2.is",
dependsOnMethods = { "testAddSP" })
dependsOnMethods = { "testAddSP" })
public void testSAMLSSOLogin() {
try {
HttpResponse response;
Expand Down Expand Up @@ -323,14 +323,14 @@ public void testSAMLSSOLogin() {
resultPage = extractDataFromResponse(response);

Assert.assertTrue(resultPage.contains("You are logged in as " + config.getUser().getTenantAwareUsername()),
"SAML SSO Login failed for " + config);
"SAML SSO Login failed for " + config);
} catch (Exception e) {
Assert.fail("SAML SSO Login test failed for " + config, e);
}
}

@Test(alwaysRun = true, description = "Testing SAML SSO Claims", groups = "wso2.is",
dependsOnMethods = { "testSAMLSSOLogin" })
dependsOnMethods = { "testSAMLSSOLogin" })
public void testClaims(){
String claimString = resultPage.substring(resultPage.lastIndexOf("<table>"));

Expand All @@ -345,7 +345,7 @@ public void testClaims(){
}

@Test(alwaysRun = true, description = "Testing SAML SSO logout", groups = "wso2.is",
dependsOnMethods = { "testSAMLSSOLogin" })
dependsOnMethods = { "testSAMLSSOLogin" })
public void testSAMLSSOLogout() throws Exception {
try {
HttpResponse response;
Expand All @@ -367,7 +367,7 @@ public void testSAMLSSOLogout() throws Exception {
String resultPage = extractDataFromResponse(response);

Assert.assertTrue(resultPage.contains("index.jsp") && !resultPage.contains("error"),
"SAML SSO Logout failed for " + config);
"SAML SSO Logout failed for " + config);
} catch (Exception e) {
Assert.fail("SAML SSO Logout test failed for " + config, e);
}
Expand Down Expand Up @@ -399,13 +399,13 @@ private void assertLocalClaims(String claims){
Map<String, String> attributeMap = extractClaims(claims);
Assert.assertTrue(attributeMap.containsKey(firstNameClaimURI), "Claim nickname is expected");
Assert.assertEquals(attributeMap.get(firstNameClaimURI), config.getUser().getNickname(),
"Expected claim value for nickname is " + config.getUser().getNickname());
"Expected claim value for nickname is " + config.getUser().getNickname());
Assert.assertTrue(attributeMap.containsKey(lastNameClaimURI), "Claim lastname is expected");
Assert.assertEquals(attributeMap.get(lastNameClaimURI), config.getUser().getUsername(),
"Expected claim value for lastname is " + config.getUser().getUsername());
"Expected claim value for lastname is " + config.getUser().getUsername());
Assert.assertTrue(attributeMap.containsKey(emailClaimURI), "Claim email is expected");
Assert.assertEquals(attributeMap.get(emailClaimURI), config.getUser().getEmail(),
"Expected claim value for email is " + config.getUser().getEmail());
"Expected claim value for email is " + config.getUser().getEmail());
}

private void assertNoneClaims(String claims){
Expand Down Expand Up @@ -439,10 +439,10 @@ private Tomcat getTomcat() {

private void setSystemProperties() {
URL resourceUrl = getClass().getResource(File.separator + "keystores" + File.separator
+ "products" + File.separator + "wso2carbon.jks");
+ "products" + File.separator + "wso2carbon.jks");
System.setProperty("javax.net.ssl.trustStore", resourceUrl.getPath());
System.setProperty("javax.net.ssl.trustStorePassword",
"wso2carbon");
"wso2carbon");
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
}

Expand Down Expand Up @@ -573,8 +573,8 @@ private void createUser(){
try {
// creating the user
remoteUSMServiceClient.addUser(config.getUser().getTenantAwareUsername(), config.getUser().getPassword(),
null, getUserClaims(),
profileName, true);
null, getUserClaims(),
profileName, true);
} catch (Exception e) {
Assert.fail("Error while creating the user", e);
}
Expand Down Expand Up @@ -659,4 +659,4 @@ private ClaimValue[] getUserClaims(){
return claimValues;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<test name="is-tests-all" preserve-order="true" parallel="false">
<packages>
<!--Entitlement Test Cases-->
<package name="org.wso2.identity.integration.test.entitlement"/>
<!--<package name="org.wso2.identity.integration.test.entitlement"/>-->
<!--Application Management Test Cases-->
<!--<package name="org.wso2.identity.integration.test.application.mgt"/>-->
</packages>
Expand All @@ -34,7 +34,7 @@
<class name="org.wso2.identity.integration.test.AuthenticationAdminTestCase"/>
<!--<class name="org.wso2.identity.integration.test.um.ws.api.RemoteAuthorizationManagerServiceTestCase" />-->
<class name="org.wso2.identity.integration.test.mgt.ClaimManagementServiceTestCase" />
<class name="org.wso2.identity.integration.test.identity.mgt.AccountLockingWhileSCIMEnabledTestCase"/>
<!--<class name="org.wso2.identity.integration.test.identity.mgt.AccountLockingWhileSCIMEnabledTestCase"/>-->
<!--Identity Management Test Cases-->
<class name="org.wso2.identity.integration.test.identity.mgt.AccountCredentialMgtConfigServiceTestCase" />
<class name="org.wso2.identity.integration.test.identity.mgt.IdentityProviderMgtServiceTestCase" />
Expand All @@ -47,15 +47,15 @@
<class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceAuthCodeGrantOpenIdTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceClientCredentialTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceImplicitGrantTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceResourceOwnerTestCase"/>
<!--<class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceResourceOwnerTestCase"/>-->
<class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceAuthCodeGrantTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2TokenRevokeAfterCacheTimeOutTestCase"/>
<!--<class name="org.wso2.identity.integration.test.oauth2.OAuth2TokenRevokeAfterCacheTimeOutTestCase"/>-->
<class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceErrorResponseTest"/>

<!--OpenId Test Cases-->
<class name="org.wso2.identity.integration.test.openid.OpenIDAuthenticationTestCase" />
<class name="org.wso2.identity.integration.test.openid.OpenIDProviderServerConfigTestCase" />
<class name="org.wso2.identity.integration.test.openid.OpenIDUserProfileTestCase"/>
<!--<class name="org.wso2.identity.integration.test.openid.OpenIDUserProfileTestCase"/>-->
<class name="org.wso2.identity.integration.test.openid.OpenIDRPManagementTestCase"/>
<!--<class name="org.wso2.identity.integration.test.openid.OpenIDSSOTestCase" />-->
<!--PassiveSTS Test Cases-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,23 @@

var log = new Log();
var selfReg = require('/controllers/user-registration/userRegistrationClient.jag');
var userRegClient = require('/controllers/user-registration/userRegistrationServiceClient.jag');
var userDTO = Packages.org.wso2.carbon.identity.user.registration.stub.dto.UserDTO;
var userFieldDTO = Packages.org.wso2.carbon.identity.user.registration.stub.dto.UserFieldDTO;

var constants = require("../../util/constants.jag");
var util = require("../../util/utility.jag");
var i18n = util.initI18N();

function edit(){
var user = new userDTO();
var messages = i18n.localize("messages");
try{
var claim = constants.DEFAULT_CLAIM_URL;
if(session.get('openid') != null){
claim = constants.OPENID_REG_CLAIM_URL;
}


var req = <xsd:addUser xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://dto.registration.user.identity.carbon.wso2.org/xsd">
<xsd:user>
<xsd1:openID></xsd1:openID>
<xsd1:password></xsd1:password>
</xsd:user>
</xsd:addUser>;

var userName = <xsd1:userName xmlns:xsd1="http://dto.registration.user.identity.carbon.wso2.org/xsd"></xsd1:userName>;

var domain = request.getParameter("domain");
var userNameVal = request.getParameter("userName");
var pwd = request.getParameter("pwd");
Expand Down Expand Up @@ -54,15 +48,17 @@ function edit(){
return;
}

req.*::user.*::openID.setChildren(session.get("openIdURL"));
req.*::user.*::password.setChildren(pwd);
userName.setChildren(domain + "/" + userNameVal);

user.setUserName(domain + "/" + userNameVal);
user.setPassword(pwd);
user.setOpenID(session.get("openIdURL")) ;


var fieldValues = selfReg.readUserFieldsForUserRegistration(claim, true);
fieldValues = fieldValues.*::['return'];

var userFields = [];
var i =0;

log.debug(fieldValues);
for each (var f in fieldValues){

Expand All @@ -77,43 +73,45 @@ function edit(){
return;
}

var fieldValue = <xsd1:userFields xmlns:xsd1="http://dto.registration.user.identity.carbon.wso2.org/xsd">
<xsd1:claimUri></xsd1:claimUri>
<xsd1:defaultValue></xsd1:defaultValue>
<xsd1:displayOrder></xsd1:displayOrder>
<xsd1:fieldName></xsd1:fieldName>
<xsd1:fieldValue></xsd1:fieldValue>
<xsd1:inputValues></xsd1:inputValues>
<xsd1:maxLength></xsd1:maxLength>
<xsd1:minLength></xsd1:minLength>
<xsd1:regEx></xsd1:regEx>
<xsd1:required></xsd1:required>
</xsd1:userFields>;

fieldValue.*::claimUri.setChildren(f.*::['claimUri'].text());
fieldValue.*::defaultValue.setChildren(f.*::['defaultValue'].text());
fieldValue.*::displayOrder.setChildren(f.*::['displayOrder'].text());
fieldValue.*::fieldName.setChildren(f.*::['fieldName'].text());

fieldValue.*::inputValues.setChildren(f.*::['inputValues'].text());
fieldValue.*::maxLength.setChildren(f.*::['maxLength'].text());
fieldValue.*::minLength.setChildren(f.*::['minLength'].text());
fieldValue.*::regEx.setChildren(f.*::['regEx'].text());
fieldValue.*::required.setChildren(f.*::['required'].text());
var fieldDTO = new userFieldDTO();
var inputValues = f.*::['inputValues'];
var inputValArray = [];
var j = 0;

for each (var inVal in inputValues){
inputValArray[j]= inVal.text();
}



fieldDTO.setClaimUri(f.*::['claimUri'].text());
fieldDTO.setDefaultValue(f.*::['defaultValue'].text());
fieldDTO.setDisplayOrder(f.*::['displayOrder'].text());
fieldDTO.setFieldName(f.*::['fieldName'].text());

fieldDTO.setInputValues(inputValArray);
fieldDTO.setMaxLength(f.*::['maxLength'].text());
fieldDTO.setMinLength(f.*::['minLength'].text());
fieldDTO.setRegEx(f.*::['regEx'].text());
fieldDTO.setRequired(Boolean(f.*::['required'].text()));

if(value != null && value.length > 0){
fieldValue.*::fieldValue.setChildren(value);
}
fieldDTO.setFieldValue(value);
} else{
fieldDTO.setFieldValue("");
}


req.*::['user'].appendChild(fieldValue);
userFields[i] = fieldDTO;
i++;
}
req.*::['user'].appendChild(userName);
selfReg.addUser(req);
user.setUserFields(userFields);
userRegClient.addUser(user);
response.sendRedirect("../../login.jag?");

}catch(e){
log.error(e);
response.sendRedirect("index.jag?e=1&error=service_invok_error");
response.sendRedirect("../../landing.jag?e=1&error=" + getErrorMessage(e.message));

}
}
Expand All @@ -138,4 +136,13 @@ function validate(value, f){

edit();

function getErrorMessage(message) {
var msg = message.split(':');
if (msg.length > 0) {
return msg[2].toString().replaceAll('\'',' ');
}
return 'Error while adding user';
}


%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<%

var log = new Log();

var util = require("../../util/utility.jag");
var serverUrl = util.getServerUrl() + "/UserRegistrationAdminService";
var connectorStub = Packages.org.wso2.carbon.identity.user.registration.stub.UserRegistrationAdminServiceStub;
var userDTO = Packages.org.wso2.carbon.identity.user.registration.stub.dto.UserDTO;
var HTTPConstants = Packages.org.apache.axis2.transport.http.HTTPConstants;

function addUser(user) {
try {
var serviceStub = new connectorStub(serverUrl);
var serviceClient = serviceStub._getServiceClient();
var option = serviceClient.getOptions();
option.setManageSession(true);
var cookie = session.get("auth-cookie");
option.setProperty(HTTPConstants.COOKIE_STRING, cookie);

serviceStub.addUser(user);
} catch (e) {
throw e;
}
}


%>
8 changes: 8 additions & 0 deletions modules/jaggery-apps/user-dashboard/dashboard/landing.jag
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
<!--[if lt IE 8]>
<link href="<%=proxyContextPath%>/css/localstyles-ie7.css" rel="stylesheet">
<![endif]-->
<%if(request.getParameter("error") != null && request.getParameter("error").length > 0) {%>
<script>
$( document ).ready(function() {
message({content: '<%=request.getParameter("error")%>', type: 'error',
cbk: function () {}});
});
</script>
<%}%>
</head>

<body>
Expand Down
5 changes: 2 additions & 3 deletions modules/p2-profile-gen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<featureArtifactDef>org.wso2.carbon.identity:org.wso2.carbon.identity.provider.server.feature:${carbon.identity.version}</featureArtifactDef>
<featureArtifactDef>org.wso2.carbon.identity:org.wso2.carbon.idp.mgt.feature:${carbon.identity.version}</featureArtifactDef>
<featureArtifactDef>org.wso2.carbon.identity:org.wso2.carbon.identity.mgt.feature:${carbon.identity.version}</featureArtifactDef>
<featureArtifactDef>org.wso2.carbon.identity:org.wso2.carbon.identity.self.registration.server.feature:${carbon.identity.version}</featureArtifactDef>
<featureArtifactDef>org.wso2.carbon.identity:org.wso2.carbon.identity.self.registration.feature:${carbon.identity.version}</featureArtifactDef>
<featureArtifactDef>org.wso2.carbon.identity:org.wso2.carbon.identity.user.profile.feature:${carbon.identity.version}</featureArtifactDef>
<featureArtifactDef>org.wso2.carbon.identity:org.wso2.carbon.identity.xacml.feature:${carbon.identity.version}</featureArtifactDef>
<featureArtifactDef>org.wso2.carbon.identity:org.wso2.carbon.claim.mgt.feature:${carbon.identity.version}</featureArtifactDef>
Expand Down Expand Up @@ -344,14 +344,13 @@
<version>${carbon.identity.version}</version>
</feature>
<feature>
<id>org.wso2.carbon.identity.self.registration.server.feature.group</id>
<id>org.wso2.carbon.identity.self.registration.feature.group</id>
<version>${carbon.identity.version}</version>
</feature>
<feature>
<id>org.wso2.carbon.identity.user.profile.feature.group</id>
<version>${carbon.identity.version}</version>
</feature>

<feature>
<id>org.wso2.carbon.identity.xacml.feature.group</id>
<version>${carbon.identity.version}</version>
Expand Down

0 comments on commit 2488453

Please sign in to comment.