Skip to content

Commit 1e0baf7

Browse files
committed
Change: Always enable JWT in authenticate request
We want to get a JWT for every authenticate response. JWT will be mandatory now.
1 parent 46058e0 commit 1e0baf7

9 files changed

Lines changed: 1 addition & 104 deletions

File tree

doc/gsad.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,6 @@ <h2>Options</h2>
117117

118118

119119

120-
121-
<p><b>--jwt-requested</b></p>
122-
123-
<p>Enable JWT-based mode using the token returned in the login response.</p>
124-
125-
126-
127-
128120
<p><b>-?, --help</b></p>
129121

130122
<p>Show help.</p>

src/gsad.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,8 +1948,6 @@ main (int argc, char **argv)
19481948
gsad_args_get_pid_filename (gsad_args));
19491949
gsad_settings_set_api_only (gsad_global_settings,
19501950
gsad_args_is_api_only_enabled (gsad_args));
1951-
gsad_settings_set_jwt_requested (gsad_global_settings,
1952-
gsad_args_is_jwt_requested (gsad_args));
19531951

19541952
gsad_settings_set_client_watch_interval (
19551953
gsad_global_settings, gsad_args_get_client_watch_interval (gsad_args));

src/gsad_args.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,16 +1062,3 @@ gsad_args_is_api_only_enabled (const gsad_args_t *args)
10621062
{
10631063
return args->api_only;
10641064
}
1065-
1066-
/**
1067-
* @brief Check if JWT requested from the login response.
1068-
*
1069-
* @param[in] args The parsed command-line arguments.
1070-
*
1071-
* @return TRUE if JWT requested mode should be enabled, FALSE otherwise.
1072-
*/
1073-
gboolean
1074-
gsad_args_is_jwt_requested (const gsad_args_t *args)
1075-
{
1076-
return args->jwt_requested;
1077-
}

src/gsad_args.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ gsad_args_is_chroot_enabled (const gsad_args_t *);
138138
gboolean
139139
gsad_args_is_api_only_enabled (const gsad_args_t *);
140140

141-
gboolean
142-
gsad_args_is_jwt_requested (const gsad_args_t *);
143-
144141
int
145142
gsad_args_validate_session_timeout (const gsad_args_t *);
146143

src/gsad_args_tests.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,26 +1708,6 @@ Ensure (gsad_args, should_free_gsad_args)
17081708
gsad_args_free (args);
17091709
}
17101710

1711-
Ensure (gsad_args, should_parse_jwt_requested)
1712-
{
1713-
gsad_args_t *args = gsad_args_new ();
1714-
char *argv[] = {"gsad", "--jwt-requested"};
1715-
gsad_args_parse (2, argv, args);
1716-
1717-
assert_that (gsad_args_is_jwt_requested (args), is_true);
1718-
gsad_args_free (args);
1719-
}
1720-
1721-
Ensure (gsad_args, should_parse_jwt_requested_default)
1722-
{
1723-
gsad_args_t *args = gsad_args_new ();
1724-
char *argv[] = {"gsad"};
1725-
gsad_args_parse (1, argv, args);
1726-
1727-
assert_that (gsad_args_is_jwt_requested (args), is_false);
1728-
gsad_args_free (args);
1729-
}
1730-
17311711
int
17321712
main (int argc, char **argv)
17331713
{
@@ -1896,8 +1876,6 @@ main (int argc, char **argv)
18961876
add_test_with_context (suite, gsad_args, should_get_dh_params_filename);
18971877
add_test_with_context (suite, gsad_args, should_get_gnutls_priorities);
18981878
add_test_with_context (suite, gsad_args, should_get_drop_privileges);
1899-
add_test_with_context (suite, gsad_args, should_parse_jwt_requested);
1900-
add_test_with_context (suite, gsad_args, should_parse_jwt_requested_default);
19011879

19021880
add_test_with_context (suite, gsad_args, should_free_gsad_args);
19031881

src/gsad_gmp.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20521,17 +20521,13 @@ authenticate_gmp (const gchar *username, const gchar *password, gchar **role,
2052120521
return 1;
2052220522
}
2052320523

20524-
gsad_settings_t *gsad_global_settings = gsad_settings_get_global_settings ();
20525-
2052620524
auth_opts = gmp_authenticate_info_opts_defaults;
2052720525
auth_opts.username = username;
2052820526
auth_opts.password = password;
2052920527
auth_opts.role = role;
2053020528
auth_opts.timezone = timezone;
2053120529
auth_opts.pw_warning = pw_warning;
20532-
auth_opts.jwt_requested =
20533-
gsad_settings_is_jwt_requested (gsad_global_settings);
20534-
auth_opts.jwt = jwt;
20530+
auth_opts.jwt_requested = TRUE;
2053520531

2053620532
auth = gmp_authenticate_info_ext_c (&connection, auth_opts);
2053720533
if (auth == 0)

src/gsad_settings.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ struct gsad_settings
4444
int session_timeout;
4545
int unix_socket;
4646
int user_session_limit;
47-
int jwt_requested;
4847
};
4948

5049
static gsad_settings_t *settings = NULL;
@@ -90,7 +89,6 @@ gsad_settings_new ()
9089
settings->session_timeout = DEFAULT_SESSION_TIMEOUT;
9190
settings->unix_socket = 0;
9291
settings->user_session_limit = DEFAULT_USER_SESSION_LIMIT;
93-
settings->jwt_requested = 0;
9492
return settings;
9593
}
9694

@@ -755,29 +753,3 @@ gsad_settings_is_api_only_enabled (const gsad_settings_t *settings)
755753
{
756754
return settings->api_only;
757755
}
758-
759-
/**
760-
* @brief Set whether a JWT token should be requested during authentication.
761-
*
762-
* @param[in] settings The settings instance to modify.
763-
* @param[in] jwt_required Whether a JWT token should be requested.
764-
*/
765-
void
766-
gsad_settings_set_jwt_requested (gsad_settings_t *settings,
767-
gboolean jwt_required)
768-
{
769-
settings->jwt_requested = jwt_required ? 1 : 0;
770-
}
771-
772-
/**
773-
* @brief Check whether a JWT token should be requested during authentication.
774-
*
775-
* @param[in] settings The settings instance to query.
776-
*
777-
* @return 1 if requesting a JWT token is enabled, 0 otherwise.
778-
*/
779-
int
780-
gsad_settings_is_jwt_requested (const gsad_settings_t *settings)
781-
{
782-
return settings->jwt_requested;
783-
}

src/gsad_settings.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,4 @@ gsad_settings_set_api_only (gsad_settings_t *, gboolean);
175175
gboolean
176176
gsad_settings_is_api_only_enabled (const gsad_settings_t *);
177177

178-
void
179-
gsad_settings_set_jwt_requested (gsad_settings_t *, gboolean);
180-
181-
int
182-
gsad_settings_is_jwt_requested (const gsad_settings_t *);
183-
184178
#endif /* _GSAD_SETTINGS_H */

src/gsad_settings_tests.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ Ensure (gsad_settings, should_use_defaults)
4545
assert_that (gsad_settings_get_client_watch_interval (settings),
4646
is_equal_to (DEFAULT_CLIENT_WATCH_INTERVAL));
4747
assert_that (gsad_settings_get_log_config_filename (settings), is_null);
48-
assert_that (gsad_settings_is_jwt_requested (settings), is_equal_to (0));
4948

5049
gsad_settings_free (settings);
5150
}
@@ -404,21 +403,6 @@ Ensure (gsad_settings, should_set_api_only)
404403
gsad_settings_free (settings);
405404
}
406405

407-
Ensure (gsad_settings, should_set_jwt_requested)
408-
{
409-
gsad_settings_t *settings = gsad_settings_new ();
410-
411-
assert_that (gsad_settings_is_jwt_requested (settings), is_equal_to (0));
412-
413-
gsad_settings_set_jwt_requested (settings, TRUE);
414-
assert_that (gsad_settings_is_jwt_requested (settings), is_equal_to (1));
415-
416-
gsad_settings_set_jwt_requested (settings, FALSE);
417-
assert_that (gsad_settings_is_api_only_enabled (settings), is_equal_to (0));
418-
419-
gsad_settings_free (settings);
420-
}
421-
422406
int
423407
main (int argc, char **argv)
424408
{
@@ -453,7 +437,6 @@ main (int argc, char **argv)
453437
add_test_with_context (suite, gsad_settings, should_set_log_config_filename);
454438
add_test_with_context (suite, gsad_settings, should_set_pid_filename);
455439
add_test_with_context (suite, gsad_settings, should_set_api_only);
456-
add_test_with_context (suite, gsad_settings, should_set_jwt_requested);
457440

458441
int ret = run_test_suite (suite, create_text_reporter ());
459442

0 commit comments

Comments
 (0)