summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth/SConscript
blob: 043641da8793d036bb600589783c21f5506eb937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# -*- mode: python -*-

Import("env")

env = env.Clone()

env.Library('serverauth', ['mongo_authentication_session.cpp'])

generateActionTypes = env.Command(
    target=['action_type.h', 'action_type.cpp'],
    source=['generate_action_types.py', 'action_types.txt'],
    action='$PYTHON $SOURCES $TARGETS')
env.Alias('generated-sources', generateActionTypes)

env.Library('auth_rolename', ['role_name.cpp'],
            LIBDEPS=[
                     '$BUILD_DIR/mongo/base',
            ]
)

env.Library(
    target = 'authentication_restriction',
    source = [
        'restriction_environment.cpp',
    ],
    LIBDEPS = [
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/util/decorable',
        '$BUILD_DIR/mongo/util/net/network',
    ],
)

env.Library(
    target='user_name',
    source=[
        'user_name.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
)

env.CppUnitTest(
    target = 'restriction_test',
    source = 'restriction_test.cpp',
    LIBDEPS = [
        '$BUILD_DIR/mongo/base',
        'authentication_restriction',
    ],
)


# Just the data structures used
env.Library(
    target='authcore',
    source=[
        'authorization_manager.cpp',
        'authorization_session.cpp',
        'auth_decorations.cpp',
        'authz_manager_external_state.cpp',
        'authz_manager_external_state_local.cpp',
        'authz_session_external_state.cpp',
        'role_graph.cpp',
        'role_graph_update.cpp',
        'role_graph_builtin_roles.cpp',
        'user.cpp',
        'user_document_parser.cpp',
        'user_management_commands_parser.cpp',
        'user_set.cpp'
    ],
    LIBDEPS=[
             'address_restriction',
             'authprivilege',
             'auth_rolename',
             'authentication_restriction',
             'sasl_options',
             'user_name',
             '$BUILD_DIR/mongo/base',
             '$BUILD_DIR/mongo/bson/mutable/mutable_bson',
             '$BUILD_DIR/mongo/bson/util/bson_extract',
             '$BUILD_DIR/mongo/crypto/scramauth',
             '$BUILD_DIR/mongo/db/catalog/document_validation',
             '$BUILD_DIR/mongo/db/common',
             '$BUILD_DIR/mongo/db/mongod_options',
             '$BUILD_DIR/mongo/db/namespace_string',
             '$BUILD_DIR/mongo/db/pipeline/lite_parsed_document_source',
             '$BUILD_DIR/mongo/db/service_context',
             '$BUILD_DIR/mongo/db/update/update_driver',
             '$BUILD_DIR/mongo/util/md5',
             '$BUILD_DIR/mongo/util/net/network',
    ],
)

env.Library(
    target='authprivilege',
    source=[
        'action_set.cpp',
        'action_type.cpp',
        'privilege.cpp',
        'privilege_parser.cpp',
        'resource_pattern.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/common',
    ]
)

env.Library('authcommon',
            ['internal_user_auth.cpp'],
            LIBDEPS=[
                '$BUILD_DIR/mongo/base',
                '$BUILD_DIR/mongo/bson/mutable/mutable_bson',
                '$BUILD_DIR/mongo/bson/util/bson_extract',
            ])

env.Library('authorization_manager_global',
            [
                'authorization_manager_global.cpp',
            ],
            LIBDEPS=[
                'authcore',
                '$BUILD_DIR/mongo/db/server_options_core',
                '$BUILD_DIR/mongo/db/service_context',
            ])

env.Library(
    target='authorization_manager_mock_init',
    source=[
        'authorization_manager_mock_init.cpp'
    ],
    LIBDEPS=[
        'authcore',
        'authmocks',
        '$BUILD_DIR/mongo/executor/thread_pool_task_executor',
        '$BUILD_DIR/mongo/executor/network_interface_thread_pool',
        '$BUILD_DIR/mongo/executor/network_interface_factory'
    ],
)

env.Library('authservercommon',
            [
                'authz_session_external_state_server_common.cpp',
                'sasl_commands.cpp',
                'security_key.cpp',
            ],
            LIBDEPS=[
                '$BUILD_DIR/mongo/db/commands/core',
                'authcommon',
                'authcore',
                'authmocks',
                'authorization_manager_global',
                'saslauth',
                'security_file',
            ])

env.Library('security_file',
            ['security_file.cpp'],
            LIBDEPS=[
                '$BUILD_DIR/mongo/base',
            ],
)

env.Library('sasl_options',
            ['sasl_options.cpp'],
            LIBDEPS=[
                '$BUILD_DIR/mongo/base',
                '$BUILD_DIR/mongo/db/server_parameters',
                '$BUILD_DIR/mongo/util/options_parser/options_parser',
            ],
)

env.Library('saslauth',
             ['native_sasl_authentication_session.cpp',
             'sasl_authentication_session.cpp',
             'sasl_plain_server_conversation.cpp',
             'sasl_scramsha1_server_conversation.cpp',
             'sasl_server_conversation.cpp'],
             LIBDEPS=[
                'authcore',
                'authmocks', # Wat?
                'sasl_options',
                '$BUILD_DIR/mongo/base/secure_allocator',
                '$BUILD_DIR/mongo/crypto/scramauth',
                '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
                '$BUILD_DIR/mongo/util/net/network',
             ],
)

env.Library('authmongod',
            ['authz_manager_external_state_d.cpp',
             'authz_session_external_state_d.cpp',
             'impersonation_session.cpp'
            ],
            LIBDEPS=[
                'authservercommon',
                '$BUILD_DIR/mongo/db/db_raii',
                '$BUILD_DIR/mongo/db/dbdirectclient',
                '$BUILD_DIR/mongo/db/dbhelpers',
                '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
                '$BUILD_DIR/mongo/db/server_parameters',
            ],
)

env.Library('authmongos',
            ['authz_manager_external_state_s.cpp',
             'authz_session_external_state_s.cpp',
             'user_cache_invalidator_job.cpp'],
            LIBDEPS=[
                'authservercommon',
                '$BUILD_DIR/mongo/s/catalog/dist_lock_manager',
                '$BUILD_DIR/mongo/s/coreshard',
            ],
)

env.Library(
    target='authmocks',
    source=[
        'authz_manager_external_state_mock.cpp'
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/matcher/expressions',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/update/update_driver',
        'authcore'
    ]
)

env.CppUnitTest('action_set_test', 'action_set_test.cpp',
                LIBDEPS=['authcore', 'authmocks', 'saslauth'])
env.CppUnitTest('privilege_parser_test', 'privilege_parser_test.cpp',
                LIBDEPS=['authcore', 'authmocks', 'saslauth'])
env.CppUnitTest('role_graph_test', 'role_graph_test.cpp',
                LIBDEPS=['authcore', 'authmocks', 'saslauth'])
env.CppUnitTest('user_document_parser_test', 'user_document_parser_test.cpp',
                LIBDEPS=['authcore', 'authmocks', 'saslauth'])
env.CppUnitTest('user_set_test', 'user_set_test.cpp',
                LIBDEPS=['authcore', 'authmocks', 'saslauth'])
env.CppUnitTest('authorization_manager_test', 'authorization_manager_test.cpp',
                LIBDEPS=[
                    '$BUILD_DIR/mongo/transport/transport_layer_common',
                    '$BUILD_DIR/mongo/transport/transport_layer_mock',
                    'authcore',
                    'authmocks',
                    'saslauth'])

env.Library(
    target='authorization_session_for_test',
    source=[
        'authorization_session_for_test.cpp',
    ],
    LIBDEPS=[
        'authcore',
    ]
)

env.CppUnitTest(
    target='authorization_session_test',
    source=[
        'authorization_session_test.cpp',
    ],
    LIBDEPS=[
        'authcore',
        'authmocks',
        'saslauth',
        'authorization_session_for_test',
        '$BUILD_DIR/mongo/db/pipeline/document_source',
        '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
        '$BUILD_DIR/mongo/transport/transport_layer_mock',
    ]
)

env.Library(
    target='address_restriction',
    source=[
        'address_restriction.cpp',
        env.Idlc('address_restriction.idl')[0],
    ],
    LIBDEPS_PRIVATE=[
        'authentication_restriction',
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/util/net/network',
        '$BUILD_DIR/mongo/idl/idl_parser',
    ],
)

env.CppUnitTest(
    target='address_restriction_test',
    source='address_restriction_test.cpp',
    LIBDEPS=[
       'address_restriction',
       '$BUILD_DIR/mongo/base',
       '$BUILD_DIR/mongo/util/net/network',
    ],
)

env.CppUnitTest('sasl_scramsha1_test',
                'sasl_scramsha1_test.cpp',
                LIBDEPS=[
                    'saslauth',
                    '$BUILD_DIR/mongo/client/sasl_client',
                ])