Skip to content

Commit

Permalink
Merge branch 'wso2-extensions:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshani authored Jul 20, 2023
2 parents fc36ea5 + 38a3da0 commit c3bbeda
Show file tree
Hide file tree
Showing 44 changed files with 48 additions and 193 deletions.
4 changes: 2 additions & 2 deletions components/org.wso2.carbon.identity.api.server.dcr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.dcr</artifactId>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
<name>WSO2 Carbon - User DCR Rest API</name>
<description>WSO2 Carbon - User DCR Rest API</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ paths:
"grant_types": ["password"],
"ext_param_client_id":"provided_client_id0001",
"ext_param_client_secret":"provided_client_secret0001" }'
"https://localhost:9443/api/identity/oauth2/dcr/v1.0/register"
"https://localhost:9443/api/identity/oauth2/dcr/v1.1/register"
x-wso2-response: |
"HTTP/1.1 201 Created"
{"client_name”:"application_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.oauth.scope</artifactId>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>

<name>WSO2 Carbon - Identity OAuth 2.0 Scope Rest APIs</name>
<description>Rest APIs for OAuth 2.0 Scope Handling</description>
Expand Down
2 changes: 1 addition & 1 deletion components/org.wso2.carbon.identity.discovery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
3 changes: 1 addition & 2 deletions components/org.wso2.carbon.identity.oauth.ciba/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>identity-inbound-auth-oauth</artifactId>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -135,7 +135,6 @@
="${identity.inbound.auth.oauth.imp.pkg.version.range}",
org.wso2.carbon.identity.oauth.* ; version
="${identity.inbound.auth.oauth.imp.pkg.version.range}",
org.wso2.carbon.registry.core.* ; version ="${carbon.kernel.imp.pkg.version.range}",
org.wso2.carbon.user.core.* ; version ="${carbon.kernel.imp.pkg.version.range}",
org.wso2.carbon.user.api.* ; version ="${carbon.user.api.imp.pkg.version.range}",
org.wso2.carbon.identity.base.* ; version =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion components/org.wso2.carbon.identity.oauth.common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public static class OAuth20Endpoints {
public static final String OAUTH20_AUTHORIZE_TOKEN_URL = "/authorize";
public static final String OAUTH2_AUTHZ_EP_URL = "oauth2/authorize";
public static final String OAUTH2_TOKEN_EP_URL = "oauth2/token";
public static final String OAUTH2_DCR_EP_URL = "/api/identity/oauth2/dcr/v1.0/register";
public static final String OAUTH2_DCR_EP_URL = "/api/identity/oauth2/dcr/v1.1/register";
public static final String OAUTH2_JWKS_EP_URL = "/oauth2/jwks";
public static final String OAUTH2_DISCOVERY_EP_URL = "/oauth2/oidcdiscovery";
public static final String OAUTH2_USER_INFO_EP_URL = "oauth2/userinfo";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 1 addition & 3 deletions components/org.wso2.carbon.identity.oauth.dcr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -151,8 +151,6 @@
org.wso2.carbon.context; version="${carbon.kernel.imp.pkg.version.range}",
org.wso2.carbon.utils.multitenancy;version="${carbon.kernel.imp.pkg.version.range}",

org.wso2.carbon.registry.api;version="${carbon.kernel.registry.imp.pkg.version.range}",
org.wso2.carbon.registry.core.*;version="${carbon.kernel.registry.imp.pkg.version.range}",
org.wso2.carbon.user.core.*; version="${carbon.kernel.imp.pkg.version.range}",

org.wso2.carbon.identity.core.*; version="${carbon.identity.framework.imp.pkg.version.range}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
import org.wso2.carbon.identity.oauth.dcr.model.RegistrationRequest;
import org.wso2.carbon.identity.oauth.dcr.model.RegistrationRequestProfile;
import org.wso2.carbon.identity.oauth.dcr.util.DCRConstants;
import org.wso2.carbon.registry.core.utils.UUIDGenerator;
import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;

import java.io.IOException;
import java.io.Reader;
import java.util.UUID;
import java.util.regex.Matcher;

import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -181,7 +181,7 @@ protected void parseJson(JSONObject jsonData, RegistrationRequest.RegistrationRe
if (objClient != null) {
registrationRequestProfile.setClientName((String) objClient);
} else {
registrationRequestProfile.setClientName(UUIDGenerator.generateUUID());
registrationRequestProfile.setClientName(UUID.randomUUID().toString());
}

registrationRequestProfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.context.RegistryType;
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig;
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationRequestConfig;
Expand All @@ -44,7 +43,6 @@
import org.wso2.carbon.identity.oauth.dcr.util.DCRMUtils;
import org.wso2.carbon.identity.oauth.dcr.util.ErrorCodes;
import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.user.core.util.UserCoreUtil;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;

Expand Down Expand Up @@ -388,10 +386,4 @@ private String createRegexPattern(List<String> redirectURIs) throws DCRException
return regexPattern.toString();
}

protected Registry getConfigSystemRegistry() {

return (Registry) PrivilegedCarbonContext.getThreadLocalCarbonContext().getRegistry(
RegistryType.SYSTEM_CONFIGURATION);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.testng.annotations.Test;
import org.wso2.carbon.base.CarbonBaseConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.context.RegistryType;
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
import org.wso2.carbon.identity.application.common.model.ServiceProvider;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
Expand All @@ -44,7 +43,6 @@
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;

import java.nio.file.Paths;
import java.rmi.registry.Registry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -454,14 +452,6 @@ public void oAuthApplicationAvailableExceptionTest() throws Exception {
fail("Expected IdentityException was not thrown by isOAuthApplicationAvailable method");
}

@Test
public void getConfigSystemRegistryTest() {
startTenantFlow();
Registry registry = (Registry) PrivilegedCarbonContext.getThreadLocalCarbonContext().
getRegistry(RegistryType.SYSTEM_CONFIGURATION);
assertEquals(dcrManagementService.getConfigSystemRegistry(), registry);
}

private void startTenantFlow() {

String carbonHome = Paths.get(System.getProperty("user.dir"), "target").toString();
Expand Down
2 changes: 1 addition & 1 deletion components/org.wso2.carbon.identity.oauth.endpoint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
import org.wso2.carbon.identity.openidconnect.OpenIDConnectClaimFilterImpl;
import org.wso2.carbon.identity.openidconnect.model.RequestObject;
import org.wso2.carbon.identity.openidconnect.model.RequestedClaim;
import org.wso2.carbon.registry.core.utils.UUIDGenerator;
import org.wso2.carbon.utils.CarbonUtils;

import java.io.IOException;
Expand Down Expand Up @@ -1879,7 +1878,7 @@ private String handleOAuthAuthorizationRequest(OAuthMessage oAuthMessage)
OAuthAuthzRequest oauthRequest = getOAuthAuthzRequest(oAuthMessage.getRequest());

OAuth2Parameters params = new OAuth2Parameters();
String sessionDataKey = UUIDGenerator.generateUUID();
String sessionDataKey = UUID.randomUUID().toString();
params.setSessionDataKey(sessionDataKey);
String redirectURI = populateOauthParameters(params, oAuthMessage, validationResponse, oauthRequest);
if (redirectURI != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.wso2.carbon.identity.openidconnect.dao.ScopeClaimMappingDAOImpl;
import org.wso2.carbon.identity.openidconnect.internal.OpenIDConnectServiceComponentHolder;
import org.wso2.carbon.identity.openidconnect.model.RequestedClaim;
import org.wso2.carbon.registry.core.service.RegistryService;

import java.sql.Connection;
import java.sql.SQLException;
Expand All @@ -72,7 +71,7 @@
/**
* This class contains tests for UserInfoJSONResponseBuilder.
*/
@PrepareForTest({OAuthServerConfiguration.class, OAuth2Util.class, IdentityTenantUtil.class, RegistryService.class,
@PrepareForTest({OAuthServerConfiguration.class, OAuth2Util.class, IdentityTenantUtil.class,
AuthorizationGrantCache.class, ClaimUtil.class, IdentityUtil.class, UserInfoEndpointConfig.class,
JDBCPersistenceManager.class})
@PowerMockIgnore({"javax.management.*"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@
<Context>/oauth2</Context>
<Context>/scim2</Context>
<Context>/api/identity/entitlement</Context>
<Context>/api/identity/oauth2/dcr/v1.0</Context>
<Context>/api/identity/oauth2/dcr/v1.1</Context>
</WebApp>
<Servlet>
<Context>/identity/(.*)</Context>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>identity-inbound-auth-oauth</artifactId>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion components/org.wso2.carbon.identity.oauth.par/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion components/org.wso2.carbon.identity.oauth.stub/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
6 changes: 1 addition & 5 deletions components/org.wso2.carbon.identity.oauth.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -45,10 +45,6 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.ui</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.core</artifactId>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion components/org.wso2.carbon.identity.oauth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>identity-inbound-auth-oauth</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>6.11.88-SNAPSHOT</version>
<version>6.11.90-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.wso2.carbon.identity.oauth.dao.OAuthAppDO;
import org.wso2.carbon.identity.oauth.dao.OAuthConsumerDAO;
import org.wso2.carbon.identity.oauth.dto.OAuthConsumerDTO;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;

Expand Down Expand Up @@ -353,8 +352,7 @@ public Parameters validateAuthenticationRequest(Parameters params)
/**
* @param oauthParams
* @return
* @throws RegistryException
* @throws IdentityException
* @throws IdentityOAuthAdminException
*/
private Parameters generateOauthToken(Parameters oauthParams) throws IdentityOAuthAdminException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.wso2.carbon.identity.oauth2.model.AuthzCodeDO;
import org.wso2.carbon.identity.oauth2.util.OAuth2Util;
import org.wso2.carbon.identity.organization.management.service.exception.OrganizationManagementException;
import org.wso2.carbon.registry.core.utils.UUIDGenerator;
import org.wso2.carbon.user.api.Tenant;
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.user.core.UserStoreManager;
Expand All @@ -66,6 +65,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
Expand Down Expand Up @@ -96,8 +96,8 @@ private OAuthUtil() {
*/
public static String getRandomNumber() throws IdentityOAuthAdminException {
try {
String secretKey = UUIDGenerator.generateUUID();
String baseString = UUIDGenerator.generateUUID();
String secretKey = UUID.randomUUID().toString();
String baseString = UUID.randomUUID().toString();
SecretKeySpec key = new SecretKeySpec(secretKey.getBytes(Charsets.UTF_8), ALGORITHM_SHA1);
Mac mac = Mac.getInstance(ALGORITHM_SHA1);
mac.init(key);
Expand All @@ -121,8 +121,8 @@ public static String getRandomNumber() throws IdentityOAuthAdminException {
*/
public static String getRandomNumberSecure() throws IdentityOAuthAdminException {
try {
String secretKey = UUIDGenerator.generateUUID();
String baseString = UUIDGenerator.generateUUID();
String secretKey = UUID.randomUUID().toString();
String baseString = UUID.randomUUID().toString();

String hmacAlgorithm;
if (Boolean.parseBoolean(IdentityUtil.getProperty(IdentityConstants.OAuth.ENABLE_SHA256_PARAMS))) {
Expand Down
Loading

0 comments on commit c3bbeda

Please sign in to comment.