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

IsClientAllowed in RedisInformationMiddleware #430

Open
half-naan opened this issue Sep 17, 2021 · 0 comments
Open

IsClientAllowed in RedisInformationMiddleware #430

half-naan opened this issue Sep 17, 2021 · 0 comments

Comments

@half-naan
Copy link

half-naan commented Sep 17, 2021

When using app.UseRedisInformation we are required to send an empty array of Allowed IP's even when we just want to use lambda function for IsClientAllowed in RedisInformationMiddleware to access /redis/connectionInfo and /redis/info.

app.UseRedisInformation(options =>
            {
                options.AllowedIPs = new System.Net.IPAddress[0];//required
                options.AllowFunction = (HttpContext ctx) =>
                {
                    // My custom logic
                    if (ctx.User.Identity.IsAuthenticated && ctx.User.IsInRole("Admin"))
                        return true;
                    return false;
                };
            });

Ideally, we should be able to skip the IP as needed.

app.UseRedisInformation(options =>
            {
                options.AllowFunction = (HttpContext ctx) =>
                {
                    // My custom logic
                    if (ctx.User.Identity.IsAuthenticated && ctx.User.IsInRole("Admin"))
                        return true;
                    return false;
                };
            });

Right now the source code is written that if there is no IP list provided it completely ignores the lambda function. Perhaps we can break IsClientAllowed in RedisInformationMiddleware to 3 different scenarios?

1). Both IP and lambda function are provided

2). Only IP list check

3). Only lambda function check

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

No branches or pull requests

1 participant