Skip to content

Commit

Permalink
fix osgi service resolving issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lashinijay committed Jan 17, 2025
1 parent 62f8c22 commit df14c67
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 55 deletions.
1 change: 0 additions & 1 deletion components/org.wso2.carbon.identity.oauth.endpoint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@
<artifactId>org.wso2.carbon.identity.oauth.extension</artifactId>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package org.wso2.carbon.identity.oauth.endpoint.authz;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.openidconnect.OpenIDConnectClaimFilter;
import org.wso2.carbon.identity.openidconnect.OpenIDConnectClaimFilterImpl;

/**
Expand All @@ -28,7 +30,13 @@ public class OAuth2AuthzServiceFactory {
private static final OpenIDConnectClaimFilterImpl SERVICE;

static {
SERVICE = new OpenIDConnectClaimFilterImpl();
OpenIDConnectClaimFilterImpl openIDConnectClaimFilter = (OpenIDConnectClaimFilterImpl)
PrivilegedCarbonContext.getThreadLocalCarbonContext().
getOSGiService(OpenIDConnectClaimFilter.class, null);
if (openIDConnectClaimFilter == null) {
throw new IllegalStateException("OpenIdConnectClaimFilter is not available from OSGi context.");
}
SERVICE = openIDConnectClaimFilter;
}

public static OpenIDConnectClaimFilterImpl getOpenIdClaimFilterImpl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.oauth2.device.api.DeviceAuthService;
import org.wso2.carbon.identity.oauth2.device.api.DeviceAuthServiceImpl;

/**
* Service holder for managing instances of Device Authentication related services.
*/
public class DeviceServiceFactory {

private static final DeviceAuthServiceImpl SERVICE;
private static final DeviceAuthService SERVICE;

static {
DeviceAuthServiceImpl deviceAuthService = (DeviceAuthServiceImpl) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(DeviceAuthServiceImpl.class, null);
DeviceAuthService deviceAuthService = (DeviceAuthService) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(DeviceAuthService.class, null);
if (deviceAuthService == null) {
throw new IllegalStateException("DeviceAuthService is not available from OSGi context.");
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
import org.wso2.carbon.identity.oauth.endpoint.util.factory.OIDCProviderServiceFactory;
import org.wso2.carbon.identity.oauth.endpoint.util.factory.Oauth2ScopeServiceFactory;
import org.wso2.carbon.identity.oauth.endpoint.util.factory.RequestObjectServiceFactory;
import org.wso2.carbon.identity.oauth.endpoint.util.factory.WebFingerServiceFactory;
import org.wso2.carbon.identity.oauth2.OAuth2ScopeService;
import org.wso2.carbon.identity.oauth2.OAuth2Service;
import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService;
Expand Down Expand Up @@ -792,8 +791,6 @@ public void testGetLoginPageURLFromCache() throws Exception {
@Test
public void testGetServices() {

assertTrue(WebFingerServiceFactory.getWebFingerService() instanceof DefaultWebFingerProcessor,
"Retrieved incorrect WebFingerService");
assertTrue(OIDCProviderRequestValidatorFactory.getOIDProviderRequestValidator()
instanceof DefaultOIDCProviderRequestBuilder,
"Retrieved incorrect OIDProviderRequestValidator");
Expand Down

0 comments on commit df14c67

Please sign in to comment.