box: make auth subsystem pluggable
This commit introduces an abstraction for the authentication code so that one can easily add new methods. To add a new method, one just needs to define a set of authentication callbacks in a struct auth_method and register it with auth_method_register. The IPROTO_AUTH and _user.auth formats were initially designed with extensibility in mind: both take the authentication method name (currently, only 'chap-sha1' is supported) so no changes to the schema are required. Note that although 'chap-sha1' is now implemented in its own file src/box/auth_chap_sha1.c, we don't merge src/scramble.c into it. This will be done later, in the scope of #7987. Since we call authentication plug-ins "methods" (not "mechanisms"), let's rename BOX_USER_FIELD_AUTH_MECH_LIST to BOX_USER_FIELD_AUTH while we are at it. Anyway, the corresponding field of the _user system space is called 'auth' (not 'auth_mech_list'). Closes #7986 NO_DOC=refactoring NO_TEST=refactoring NO_CHANGELOG=refactoring
Showing
- extra/exports 0 additions, 1 deletionextra/exports
- src/box/CMakeLists.txt 1 addition, 0 deletionssrc/box/CMakeLists.txt
- src/box/alter.cc 26 additions, 27 deletionssrc/box/alter.cc
- src/box/applier.cc 11 additions, 4 deletionssrc/box/applier.cc
- src/box/auth_chap_sha1.c 186 additions, 0 deletionssrc/box/auth_chap_sha1.c
- src/box/auth_chap_sha1.h 23 additions, 0 deletionssrc/box/auth_chap_sha1.h
- src/box/authentication.c 97 additions, 23 deletionssrc/box/authentication.c
- src/box/authentication.h 196 additions, 0 deletionssrc/box/authentication.h
- src/box/box.cc 2 additions, 0 deletionssrc/box/box.cc
- src/box/errcode.h 3 additions, 0 deletionssrc/box/errcode.h
- src/box/lua/misc.cc 38 additions, 0 deletionssrc/box/lua/misc.cc
- src/box/lua/net_box.c 17 additions, 13 deletionssrc/box/lua/net_box.c
- src/box/lua/schema.lua 11 additions, 16 deletionssrc/box/lua/schema.lua
- src/box/schema_def.h 1 addition, 1 deletionsrc/box/schema_def.h
- src/box/user_def.c 4 additions, 4 deletionssrc/box/user_def.c
- src/box/user_def.h 10 additions, 7 deletionssrc/box/user_def.h
- src/box/xrow.c 12 additions, 16 deletionssrc/box/xrow.c
- src/box/xrow.h 9 additions, 8 deletionssrc/box/xrow.h
- test/box-luatest/ghs_16_user_enumeration_test.lua 8 additions, 4 deletionstest/box-luatest/ghs_16_user_enumeration_test.lua
- test/box/error.result 3 additions, 0 deletionstest/box/error.result
Loading
Please register or sign in to comment