Skip to content

Commit

Permalink
add HA auth
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoby committed Mar 20, 2024
1 parent 0450048 commit f0e536c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion inc_internal/auth_method.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ struct ziti_auth_method_s {
};

ziti_auth_method_t *new_legacy_auth(ziti_controller *ctrl);
ziti_auth_method_t *new_ha_auth(ziti_context ztx);
ziti_auth_method_t *new_ha_auth(uv_loop_t *l, const char *url, tls_context *tls);

#endif // ZITI_SDK_AUTH_METHOD_H
1 change: 1 addition & 0 deletions library/oidc.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ int oidc_client_init(uv_loop_t *loop, oidc_client_t *clt, const char *url, tls_c
if (rc != 0) {
return rc;
}
tlsuv_http_set_path_prefix(&clt->http, "");
tlsuv_http_set_ssl(&clt->http, tls);

clt->timer = calloc(1, sizeof(*clt->timer));
Expand Down
10 changes: 5 additions & 5 deletions library/ziti.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ void ziti_set_fully_authenticated(ziti_context ztx, const char *session_token) {
free(ztx->session_token);
ztx->session_token = strdup(session_token);
}

if (ztx->auth_method->kind == HA) {
ziti_ctrl_set_token(&ztx->controller, session_token);
}
ziti_ctrl_get_well_known_certs(&ztx->controller, ca_bundle_cb, ztx);
ziti_ctrl_current_identity(&ztx->controller, update_identity_data, ztx);

Expand Down Expand Up @@ -1685,14 +1687,12 @@ static void version_pre_auth_cb(ziti_version *version, const ziti_error *err, vo
ztx->auth_method = NULL;
}


if (ha) {
// TODO
ZTX_LOG(ERROR, "HA mode is not supported");
ztx->auth_method = new_ha_auth(ztx->loop, ztx->config.controller_url, ztx->tlsCtx);
} else {
ztx->auth_method = new_legacy_auth(&ztx->controller);
ztx->auth_method->start(ztx->auth_method, ztx_auth_state_cb, ztx);
}
ztx->auth_method->start(ztx->auth_method, ztx_auth_state_cb, ztx);
}

free_ziti_version_ptr(version);
Expand Down

0 comments on commit f0e536c

Please sign in to comment.