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

Check namespaceId is exist when some api need namespace to handle #4134

Open
horizonzy opened this issue Nov 4, 2020 · 6 comments
Open

Check namespaceId is exist when some api need namespace to handle #4134

horizonzy opened this issue Nov 4, 2020 · 6 comments
Assignees
Labels

Comments

@horizonzy
Copy link
Collaborator

Describe the bug
Now I register a instance with the not exist namespaceId. In server, com.alibaba.nacos.naming.core.ServiceManager will create a new namesapce, and put service in it.
For this situation, we should check the namespaceId is exist. If the situation is not exist, throw an exception.

@KomachiSion
Copy link
Collaborator

KomachiSion commented Nov 4, 2020

If need to check whether namespace is exist, it will depend persistency module first.

we may need to discuss and extract the persistency module first

@KomachiSion KomachiSion added the kind/feature type/feature label Nov 4, 2020
@KomachiSion KomachiSion added this to the 1.4.1 milestone Nov 4, 2020
@horizonzy
Copy link
Collaborator Author

Maybe we can add a filter in console module to fix it

@KomachiSion
Copy link
Collaborator

And need to cache namespace in memory, and need to maintain the cache.

@CaiJiHuzhuo
Copy link

CaiJiHuzhuo commented Jan 7, 2021

I noticed in the nacos documentation that the namespace module will be moved to the public module. which module? common?
3

@horizonzy
Copy link
Collaborator Author

I think move it to core module will be better, like authFilter.

@KomachiSion KomachiSion modified the milestones: 1.4.1, 1.4.2 Jan 13, 2021
@realJackSun
Copy link
Collaborator

realJackSun commented Mar 3, 2021

Add a NamespaceFilter like this?

public class NamespaceFilter implements Filter {
    Set<String> existingNamespaces;
    ...
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
        String namespace = request.getNamespace();
        if (!existingNamespaces.contains(namespace)) {
             existingNamespaces.replace(namespace, "public");
       }
   }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants