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

Restrict cross-tenant Multi Attribute Login Identifier lookups #201

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
~ Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 LLC. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -118,14 +118,16 @@
</Export-Package>
<Import-Package>
org.apache.commons.lang,
org.apache.commons.logging,
HasiniSama marked this conversation as resolved.
Show resolved Hide resolved
org.osgi.framework; version="${org.osgi.framework.imp.pkg.version.range}",
org.osgi.service.component; version="${org.osgi.service.imp.pkg.version.range}",
org.wso2.carbon.identity.application.authentication.framework; version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.identity.application.authentication.framework.util; version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.identity.central.log.mgt.utils; version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.identity.multi.attribute.login.mgt; version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.user.core.common; version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.utils*;version="${carbon.kernel.package.import.version.range}"
org.wso2.carbon.utils*;version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.identity.core.util; version="${carbon.identity.package.import.version.range}"
</Import-Package>
</instructions>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,30 @@

package org.wso2.carbon.identity.conditional.auth.functions.utils;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.graalvm.polyglot.HostAccess;
import org.wso2.carbon.identity.application.authentication.framework.util.FrameworkUtils;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
import org.wso2.carbon.identity.multi.attribute.login.mgt.ResolvedUserResult;

/**
* Function to resolve user from multi attribute login identifier.
*/
public class ResolveMultiAttributeLoginIdentifierFunctionImpl implements ResolveMultiAttributeLoginIdentifierFunction {

private static final Log log = LogFactory.getLog(ResolveMultiAttributeLoginIdentifierFunctionImpl.class);

@Override
@HostAccess.Export
public String resolveMultiAttributeLoginIdentifier(String loginIdentifier, String tenantDomain) {

if (!IdentityTenantUtil.resolveTenantDomain().equals(tenantDomain)) {
if (log.isDebugEnabled()) {
log.debug("Cross-tenant multi attribute login identifier lookup is not allowed.");
}
return null;
}
ResolvedUserResult resolvedUserResult = FrameworkUtils.processMultiAttributeLoginIdentification(
loginIdentifier, tenantDomain);

Expand Down
Loading