]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1421] Addressed comments
authorFrancis Dupont <fdupont@isc.org>
Fri, 20 Nov 2020 08:58:12 +0000 (09:58 +0100)
committerTomek Mrugalski <tomek@isc.org>
Fri, 20 Nov 2020 10:45:48 +0000 (11:45 +0100)
ChangeLog
src/bin/agent/agent_hooks.dox
src/bin/agent/tests/ca_response_creator_unittests.cc

index 30965c56f054ecd2513afb566a1ad9493c0c5975..03300c3b3de347d94adb2708c002e3d4cd9f6520 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+1834.  [func]          fdupont
+       Added two new callouts (hook points) in the control agent.
+       The "auth" callout is executed after the basic authentication
+       (if configured) and the command processing. The "response"
+       callout is executed after the command processing and before
+       the HTTP response is returned.
+       (Gitlab #1421)
+
 1833.  [doc]           sgoldlust
        Many documentation corrections.
        (Gitlab #1539)
index 641eb55c27025361f8edcef23106b2516b31d739..fcde63901e5ba9dd6dde0a0c8678f468f3a143ba 100644 (file)
@@ -51,6 +51,6 @@ command.
    reference and for callout contexts. The "response" argument is the
    response which will be sent back to the resquesting client.  It is
    called after command processing.  The next step status is ignored:
-   the response eventually modified will be sent back.
+   the response possibly modified will be sent back.
 
 */
\ No newline at end of file
index eb3658146a6ef8b0a4c0828771dbd95153fcd479..38ae18e9f223c942281307bbcaca0f1bfe017f8a 100644 (file)
@@ -327,6 +327,8 @@ TEST_F(CtrlAgentResponseCreatorTest, hookNoAuth) {
     setBasicContext(request_);
 
     // Body: "list-commands" is natively supported by the command manager.
+    // We add a random value in the extra entry: see next unit test
+    // for an explanation about how it is used.
     auto r32 = isc::cryptolink::random(4);
     ASSERT_EQ(4, r32.size());
     int extra = r32[0];
@@ -381,6 +383,16 @@ TEST_F(CtrlAgentResponseCreatorTest, hookBasicAuth) {
     setBasicContext(request_);
 
     // Body: "list-commands" is natively supported by the command manager.
+    // We add a random value in the extra entry:
+    //  - this proves that the auth callout can get the request argument
+    //  - this proves that the auth callout can modify the request argument
+    //    before the request is executed (the extra entry if still present
+    //    would make the command to be rejected as malformed)
+    //  - this proves that a value can be communicate between the auth
+    //    and response callout points
+    //  - this proves that the response callout can get the response argument
+    //  - this proves that the response callout can modify the response
+    //    argument
     auto r32 = isc::cryptolink::random(4);
     ASSERT_EQ(4, r32.size());
     int extra = r32[0];