-
Notifications
You must be signed in to change notification settings - Fork 30
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
Introduce RBAC checking via custom authHandler function #218
base: v1.x/staging
Are you sure you want to change the base?
Conversation
Signed-off-by: Leanid Astrakou <[email protected]>
The code is questionable because it introduces a dependency on zss by calling functions defined there. Could we introduce typedef bool (*MiddlewareCallback)(HttpServer *server, HttpResponse *response, HttpMiddleware *middleware);
typedef struct HttpMiddleware {
HttpMiddlewareCallback middlewareFunction;
///...
HttpMIddleware *next;
} HttpMiddleware;
struct HttpServer {
//...
HttpMiddleware *middlewareList; // list of middleware
}
// in zss
HttpMiddleware *middleware = makeMiddleware(...);
middleware->middlewareFunction = myFunction;
registerHttpMiddleware(server, middleware); Edit (@DivergentEuropeans ) : This has now been addressed |
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leanid Astrakou <[email protected]>
Signed-off-by: Leonty Chudinov <[email protected]>
Signed-off-by: Leonty Chudinov <[email protected]>
Signed-off-by: Leonty Chudinov <[email protected]>
Signed-off-by: Leonty Chudinov <[email protected]>
Signed-off-by: Leonty Chudinov <[email protected]>
Signed-off-by: Leonty Chudinov <[email protected]>
Signed-off-by: Leonty Chudinov <[email protected]>
…gisterHttpAuthorizationHandler Add return code for registerHttpAuthorizationHandler
Signed-off-by: Leonty Chudinov <[email protected]>
…andler Rename AuthorizationHandler to HttpAuthorize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, @lchudinov please also have a look, I think you're more familiar with the changes and the goals of those changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, @rocketjared, perhaps you're interested in these changes.
@lchudinov, please re-review, it's always good to go over changes related to security multiple times
if (!head) { | ||
server->authorizationHandlerList = handler; | ||
} else { | ||
while (head->next != NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nit: you could've used first/last pointers to do O(1) insertion:
if (server->firstAuthHandler) {
server->lastAuthHandler->next = handler;
} else {
server->firstAuthHandler = handler;
}
server->lastAuthHandler = handler;
Or if you don't care about the current order:
handler->next = server->authorizationHandlerList;
server->authorizationHandlerList = handler;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation not so critical for now as we have only one authorization handler. It can be improved in the future when we for sure know what we want to optimize.
PR (2 of 2)
PR 1: zowe/zss#281
Signed-off-by: Leanid Astrakou [email protected]