Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDSDEV-678-Add New Publishing Points for Token Failure #256

Open
wants to merge 59 commits into
base: mig-release-2.2.0-integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3404dfa
IDSDEV-365 Mobile Connect Request Validator Capability in IDGW Relate…
udithad Apr 25, 2017
bce5805
Merge pull request #191 from udithad/mig-release-2.2.0-m2
Apr 26, 2017
3a1e0df
IDSDEV-548 Bug fixes for updating sp-configuration table,Bug fixed wh…
Apr 28, 2017
18db275
Merge pull request #194 from Lakini/mig-release-2.2.0-m2
madushak Apr 28, 2017
ed9c107
IDSDEV-365 Discovery Call modifications
udithad Jun 7, 2017
e98d745
User Consent implementation for ticket IDSDEV-489
Apr 26, 2017
a411f81
change for UserConsent IDSDEV-489
May 5, 2017
9465400
consent flow changed, multiscope design added for JIRA IDSDEV-489
May 28, 2017
271e041
Consent deny for MSISDN Added
May 29, 2017
91a8e30
Consent Deny DB merged with user_consent DB for JIRA IDSDEV-489
May 31, 2017
fbbd249
Consent deny for MSISDN Added
May 29, 2017
bde3428
Fix for Parent scope without consent
Jun 7, 2017
49210d2
LOA3 Fix, UI Fix
Jun 14, 2017
236fe57
Added self service portal API
madushak Apr 7, 2017
aa4871d
Added login history and refactored self service portal
madushak Apr 18, 2017
e973522
Added login history and refactored self service portal
madushak Apr 20, 2017
6da41e8
Added angular app to component - IDSDEV-379
madushak Apr 27, 2017
2b48794
Adding Login history component
sahantelco May 4, 2017
9833050
IDSDEV-553 - Fixing error on npm Build Production
sahantelco May 5, 2017
1ee4444
adding anjular build files
sahantelco May 5, 2017
c1dd271
Added cross origin filter
madushak May 5, 2017
7bd5469
Changed the ngfor
madushak May 5, 2017
0fac668
Added login count API method
madushak May 8, 2017
17c4705
Added Pin reset swagger
madushak May 8, 2017
8dbe38e
[IDSDEV-553] build anjular files
sahantelco May 5, 2017
52511f4
[IDSDEV-559] Create PIN reset page with form validation
sahantelco May 9, 2017
a9b3e11
[IDSDEV-500] activity widget modification
sahantelco May 9, 2017
34b2574
Added PIN reset API method and get current LOA api - IDSDEV-557
madushak May 9, 2017
ecc013d
PIN reset UI - IDSDEV-557
madushak May 15, 2017
906b7e1
Added login summary chart and pin reset IDSDEV-557
madushak May 19, 2017
c40a4e1
Code cleanup IDSDEV-557
madushak May 22, 2017
73289ee
Footer modification
sahantelco May 23, 2017
b991bda
Added profile upgrade flow - IDSDEV-557
madushak May 24, 2017
dcd8943
Rename README to README.md
madushak May 30, 2017
72e521c
Update README.md
madushak May 30, 2017
448c23b
Added build scripts and hashed pin reset - IDSDEV-557
madushak May 30, 2017
3230c0c
Changed login history sort order - IDSDEV-557
madushak May 30, 2017
a4f3e32
[IDSDEV-564] Theme change accourding to mobileconnect color schema
sahantelco May 30, 2017
e293348
Fixing Undefined param usage for common service call
sahantelco Jun 13, 2017
78fbc52
Fixing URL path(pin reset/signout) issue
sahantelco Jun 14, 2017
31ddea6
[IDSDEV-605] UI Improvements
sahantelco Jul 4, 2017
1810301
[IDSDEV-604] User can not log into self service portal after login ou…
sahantelco Jul 5, 2017
7920e79
Merge branch 'mig-release-2.2.0-m3' into mig-release-2.2.0-integration
udithad Jul 6, 2017
93f1859
Changed core-util version reference
udithad Jul 6, 2017
c5296ea
[IDSDEV-619] Fixed the issue : unable to log into self service Portal…
Jul 12, 2017
75db0a8
Scope Validation Changes, LOA Level Fix, User Info Fix
Jul 24, 2017
59196b3
IDSDEV-607 web-service for off-line user registration
nilan84 Jun 29, 2017
bc9d57a
IDSDEV-607 web-service for off-line user registration
nilan84 Jun 30, 2017
f365d6d
IDSDEV-607 web-service for off-line user registration
nilan84 Jul 3, 2017
957dc1c
IDSDEV-608 Create rest web-service for user unregister
nilan84 Jul 12, 2017
5d9e2b5
IDSDEV-646
nilan84 Jul 24, 2017
de8ada3
Resolve merge conflicts for SP Provisioning
udithad Jul 25, 2017
5ec36d9
Merge branch 'mig-release-2.1.0-ext-m3' into mig-release-2.2.0-integr…
udithad Jul 25, 2017
55eecf7
Adding minor changes to resolve merge issues
udithad Jul 26, 2017
b822f55
IDSDEV-592
nilan84 Aug 1, 2017
b798d63
IDSDEV-592
nilan84 Aug 1, 2017
913f08a
IDSDEV-678-Add New Publishing Points for Token Failure
tharsigam Aug 29, 2017
70a6d2a
IDSDEV-678
tharsigam Aug 29, 2017
b36ad46
Code Refactor
tharsigam Sep 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ target
*pom.xml.tag
*release.properties
features/com.wso2telco.ids.dashboard.ui.feature/src/main/resources/generated/dashboard.zip
components/self-service-portal/src/angular-source/node_modules
12 changes: 12 additions & 0 deletions components/auth-proxy-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@
<version>2.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.wso2telco.ids</groupId>
<artifactId>sp-seamless-provision</artifactId>
<version>2.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.wso2telco.core</groupId>
<artifactId>spprovisionservice</artifactId>
<version>2.0.23-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,62 @@
******************************************************************************/
package com.wso2telco.proxy.entity;

import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.rmi.RemoteException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;

import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.naming.ConfigurationException;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.UriInfo;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.identity.application.authentication.framework.exception.AuthenticationFailedException;
import org.wso2.carbon.identity.user.registration.stub.UserRegistrationAdminService;
import org.wso2.carbon.identity.user.registration.stub.UserRegistrationAdminServiceException;
import org.wso2.carbon.identity.user.registration.stub.UserRegistrationAdminServiceIdentityException;
import org.wso2.carbon.identity.user.registration.stub.UserRegistrationAdminServiceStub;
import org.wso2.carbon.identity.user.registration.stub.UserRegistrationAdminServiceUserRegistrationException;
import org.wso2.carbon.identity.user.registration.stub.dto.UserDTO;
import org.wso2.carbon.identity.user.registration.stub.dto.UserFieldDTO;

import com.google.gdata.util.common.util.Base64DecoderException;
import com.sun.jersey.spi.container.ContainerRequest;
import com.wso2telco.core.config.model.LoginHintFormatDetails;
import com.wso2telco.core.config.model.MobileConnectConfig;
import com.wso2telco.core.config.model.ScopeParam;
import com.wso2telco.core.config.service.ConfigurationService;
import com.wso2telco.core.config.service.ConfigurationServiceImpl;
import com.wso2telco.core.spprovisionservice.sp.entity.AdminServiceConfig;
import com.wso2telco.core.spprovisionservice.sp.entity.AdminServiceDto;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Remove this unused import 'com.wso2telco.core.spprovisionservice.sp.entity.AdminServiceDto'. rule

import com.wso2telco.core.spprovisionservice.sp.entity.ProvisionType;
import com.wso2telco.core.spprovisionservice.sp.entity.ServiceProviderDto;
import com.wso2telco.core.spprovisionservice.sp.entity.SpProvisionConfig;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Remove this unused import 'com.wso2telco.core.spprovisionservice.sp.entity.SpProvisionConfig'. rule

import com.wso2telco.core.spprovisionservice.sp.entity.SpProvisionDto;
import com.wso2telco.core.spprovisionservice.sp.exception.SpProvisionServiceException;
import com.wso2telco.ids.datapublisher.model.UserStatus;
import com.wso2telco.ids.datapublisher.util.DataPublisherUtil;
import com.wso2telco.proxy.MSISDNDecryption;
Expand All @@ -32,6 +81,11 @@
import com.wso2telco.proxy.util.DBUtils;
import com.wso2telco.proxy.util.Decrypt;
import com.wso2telco.proxy.util.EncryptAES;
import com.wso2telco.sp.discovery.service.DiscoveryService;
import com.wso2telco.sp.discovery.service.impl.DiscoveryServiceImpl;
import com.wso2telco.sp.provision.service.ProvisioningService;
import com.wso2telco.sp.provision.service.impl.ProvisioningServiceImpl;
import com.wso2telco.sp.util.TransformUtil;
import org.apache.commons.lang.StringUtils;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Remove this duplicated import. rule

import org.apache.commons.logging.Log;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Remove this duplicated import. rule

import org.apache.commons.logging.LogFactory;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Remove this duplicated import. rule

Expand Down Expand Up @@ -71,6 +125,7 @@ public class Endpoints {
private static MobileConnectConfig mobileConnectConfigs = null;
private static Map<String, List<MSISDNHeader>> operatorsMSISDNHeadersMap;
private static Map<String, MobileConnectConfig.OPERATOR> operatorPropertiesMap = null;
private static AdminServiceConfig adminServiceConfig = null;

/**
* The Configuration service
Expand Down Expand Up @@ -104,6 +159,8 @@ public class Endpoints {
for (MobileConnectConfig.OPERATOR op : operators) {
operatorPropertiesMap.put(op.getOperatorName(), op);
}
adminServiceConfig = new AdminServiceConfig();
getSpProvisionConfig(mobileConnectConfigs);
} catch (SQLException e) {
log.error("Error occurred while retrieving operator MSISDN properties of operators.");
} catch (NamingException e) {
Expand All @@ -127,6 +184,7 @@ public void RedirectToAuthorizeEndpoint(@Context HttpServletRequest httpServletR
String redirectURL = queryParams.get(AuthProxyConstants.REDIRECT_URI).get(0);
String scopeName = queryParams.get(AuthProxyConstants.SCOPE).get(0);

serviceProviderSeamlessProvision(httpServletRequest.getParameter("client_id"), redirectURL);

//maintain userstatus related to request for data publishing purpose
UserStatus userStatus = DataPublisherUtil.buildUserStatusFromRequest(httpServletRequest, null);
Expand Down Expand Up @@ -204,6 +262,13 @@ public void RedirectToAuthorizeEndpoint(@Context HttpServletRequest httpServletR
//Validate with Scope wise parameters and throw exceptions
ScopeParam scopeParam = validateAndSetScopeParameters(loginHint, msisdn, scopeName, redirectUrlInfo,
userStatus);

String apiScopes = null;
if(scopeParam.isConsentPage()==true){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Remove the literal "true" boolean value. rule

String[] api_Scopes = scopeName.split("\\s+");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule

api_Scopes=Arrays.copyOfRange(api_Scopes, 1, api_Scopes.length);
apiScopes=Arrays.toString(api_Scopes);
}

String loginhint_msisdn = null;
try {
Expand Down Expand Up @@ -262,7 +327,9 @@ public void RedirectToAuthorizeEndpoint(@Context HttpServletRequest httpServletR
redirectUrlInfo.setQueryString(queryString);
redirectUrlInfo.setIpAddress(ipAddress);
redirectUrlInfo.setTelcoScope(operatorScopeWithClaims);
redirectUrlInfo.setParentScope(scopeParam.getScope());
redirectUrlInfo.setTransactionId(userStatus.getTransactionId());
redirectUrlInfo.setApiScopes(apiScopes);
redirectURL = constructRedirectUrl(redirectUrlInfo, userStatus);

DataPublisherUtil.updateAndPublishUserStatus(
Expand All @@ -285,6 +352,64 @@ public void RedirectToAuthorizeEndpoint(@Context HttpServletRequest httpServletR
httpServletResponse.sendRedirect(redirectURL);
}

private void serviceProviderSeamlessProvision(String client_id, String redirectURL) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule

DiscoveryService discoveryService = new DiscoveryServiceImpl();
if (mobileConnectConfigs.isSeamlessProvisioningEnabled() && !client_id.isEmpty() && client_id != null &&

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Remove this expression which always evaluates to "true" rule

!redirectURL.isEmpty() && redirectURL != null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Remove this expression which always evaluates to "true" rule

ServiceProviderDto serviceProviderDto = discoveryService.servceProviderCredentialDiscovery(
TransformUtil.transformDiscoveryConfig(mobileConnectConfigs.getDiscoveryConfig(),
mobileConnectConfigs),
TransformUtil.transofrmDiscoveryDto(client_id, redirectURL,mobileConnectConfigs),
getServiceProviderDto(null, mobileConnectConfigs));

if (serviceProviderDto != null && serviceProviderDto.getExistance().equals(ProvisionType.REMOTE)
&& serviceProviderDto.getAdminServiceDto() != null) {
log.info("Provisioning Service Provider to Local data store....");
serviceProviderSeamlessProvision(serviceProviderDto);
}
}
}

private void serviceProviderSeamlessProvision(ServiceProviderDto serviceProvider) {

SpProvisionDto spProvisionDto = null;

try {

boolean isSeamlessProvisioningEnabled = mobileConnectConfigs.isSeamlessProvisioningEnabled();
MobileConnectConfig.Config config = mobileConnectConfigs.getSpProvisionConfig().getConfig();

if (isSeamlessProvisioningEnabled && serviceProvider != null) {
if (config != null) {
spProvisionDto = getServiceProviderDto(serviceProvider, mobileConnectConfigs);
ProvisioningService provisioningService = new ProvisioningServiceImpl();
provisioningService.provisionServiceProvider(spProvisionDto);
} else {
log.error("Config null");
}
}
} catch (SpProvisionServiceException e) {
log.error("Error occurred in provisioning a Service Provider " + e.getMessage());
}
}

private SpProvisionDto getServiceProviderDto(ServiceProviderDto serviceProvider,
MobileConnectConfig config) {

SpProvisionDto spProvisionDto = TransformUtil.getServiceProviderDto(serviceProvider, config);
spProvisionDto.getSpProvisionConfig().setAdminServiceConfig(adminServiceConfig);
return spProvisionDto;

}

private static AdminServiceConfig getSpProvisionConfig(MobileConnectConfig config) {
adminServiceConfig.setAdminServiceUrl(config.getSpProvisionConfig().getAdminServiceUrl());
adminServiceConfig
.setApplicationManagementHostUrl(config.getSpProvisionConfig().getApplicationManagementHostUrl());
adminServiceConfig.setStubAccessPassword(config.getSpProvisionConfig().getStubAccessPassword());
adminServiceConfig.setStubAccessUserName(config.getSpProvisionConfig().getStubAccessUserName());
return adminServiceConfig;
}

/**
* Check if the Scope is allowed for SP
Expand Down Expand Up @@ -627,16 +752,18 @@ private String constructRedirectUrl(RedirectUrlInfo redirectUrlInfo, UserStatus
String loginHintMsisdn = redirectUrlInfo.getLoginhintMsisdn();
String operatorName = redirectUrlInfo.getOperatorName();
String telcoScope = redirectUrlInfo.getTelcoScope();
String parentScope = redirectUrlInfo.getParentScope();
String ipAddress = redirectUrlInfo.getIpAddress();
String prompt = redirectUrlInfo.getPrompt();
String apiScopes = redirectUrlInfo.getApiScopes();
boolean isShowTnc = redirectUrlInfo.isShowTnc();
ScopeParam.msisdnMismatchResultTypes headerMismatchResult = redirectUrlInfo.getHeaderMismatchResult();
ScopeParam.heFailureResults heFailureResult = redirectUrlInfo.getHeFailureResult();

String transactionId = redirectUrlInfo.getTransactionId();
if (authorizeUrl != null) {
redirectURL = authorizeUrl + queryString + "&" + AuthProxyConstants.OPERATOR + "=" +
operatorName + "&" + AuthProxyConstants.TELCO_SCOPE + "=" + telcoScope + "&" +
operatorName + "&" + AuthProxyConstants.TELCO_SCOPE + "=" + telcoScope + "&" + AuthProxyConstants.PARENT_SCOPE + "=" + parentScope + "&" +
AuthProxyConstants.SHOW_TNC + "=" + isShowTnc + "&" + AuthProxyConstants.HEADER_MISMATCH_RESULT +
"=" + headerMismatchResult + "&" + AuthProxyConstants.HE_FAILURE_RESULT +
"=" + heFailureResult;
Expand Down Expand Up @@ -664,6 +791,12 @@ private String constructRedirectUrl(RedirectUrlInfo redirectUrlInfo, UserStatus
redirectURL = redirectURL + "&" + AuthProxyConstants.TELCO_PROMPT +
"=" + prompt;
}

if(apiScopes != null && !StringUtils.isEmpty(apiScopes)){
redirectURL = redirectURL + "&" + AuthProxyConstants.API_SCOPES +
"=" + apiScopes;
}

} else {
String errMsg = "AuthorizeURL could not be found in mobile-connect.xml";
DataPublisherUtil.updateAndPublishUserStatus(userStatus, DataPublisherUtil.UserState.CONFIGURATION_ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ public class RedirectUrlInfo {
private String loginhintMsisdn;
private String ipAddress;
private String telcoScope;
private String parentScope;
private boolean isLoginhintMandatory;
private boolean showTnc;
private ScopeParam.msisdnMismatchResultTypes headerMismatchResult;
private ScopeParam.heFailureResults heFailureResult;
private String transactionId;
private String prompt;
private String apiScopes;

public void setPrompt(String prompt) { this.prompt = prompt; }

Expand All @@ -55,7 +57,15 @@ public void setTelcoScope(String telcoScope) {
this.telcoScope = telcoScope;
}

public String getIpAddress() {
public String getParentScope() {
return parentScope;
}

public void setParentScope(String parentScope) {
this.parentScope = parentScope;
}

public String getIpAddress() {
return ipAddress;
}

Expand Down Expand Up @@ -134,4 +144,12 @@ public void setTransactionId(String transactionId) {
public String getTransactionId() {
return transactionId;
}

public String getApiScopes() {
return apiScopes;
}

public void setApiScopes(String apiScopes) {
this.apiScopes = apiScopes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class AuthProxyConstants {
public static final String SCOPE_MNV = "mnv";
public static final String SCOPE_OPENID = "openid";
public static final String TELCO_SCOPE = "telco_scope";
public static final String PARENT_SCOPE = "parent_scope";
public static final String API_SCOPES = "api_scope";
public static final String UTF_ENCODER = "UTF-8";
public static final String SHOW_TNC = "isShowTnc";
public static final String LOGIN_HINT_MANDATORY = "isLoginhintMandatory";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public static Map<String, ScopeParam> getScopeParams(String scope) throws Authen
parameters.setHeFailureResult(ScopeParam.heFailureResults.valueOf(results.getString(
"he_failure_result")));
parameters.setTncVisible(results.getBoolean("is_tnc_visible"));
parameters.setConsentPage(results.getBoolean("is_consent_page"));
parameters.setLoginHintFormat(getLoginHintFormatTypeDetails(results.getInt("param_id"), conn));

scopeParamsMap.put("params", parameters);
Expand Down
10 changes: 10 additions & 0 deletions components/authentication-endpoint/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@
<servlet-name>registration.do</servlet-name>
<jsp-file>/registration.jsp</jsp-file>
</servlet>

<servlet>
<servlet-name>user_consent.do</servlet-name>
<jsp-file>/mcx-user-registration/user_consent.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>terms_and_conditions</servlet-name>
Expand Down Expand Up @@ -356,6 +361,11 @@
<servlet-name>registration.do</servlet-name>
<url-pattern>/registration.do</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>user_consent.do</servlet-name>
<url-pattern>/consent.do</url-pattern>
</servlet-mapping>

<error-page>
<exception-type>java.lang.Throwable</exception-type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
alt="Mobile Connect&nbsp;Logo" width="150"
class="site-header__logo"></a>
<% if (!operator.isEmpty()) {
String imgPath = "images/branding/" + operator + "_logo.svg";
String imgPath = "mcx-user-registration/images/branding/" + operator + "_logo.svg";
%>
<p class="site-header__powered-by">powered&nbsp;by

Expand Down
Loading