Skip to content

Commit

Permalink
Specify the auth hostname in the constructor
Browse files Browse the repository at this point in the history
Specify the auth hostname in the constructor instead of via a separate
method as authentication occurs immediately.
  • Loading branch information
mstemm committed Dec 28, 2016
1 parent 83e8612 commit f216efe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 2 additions & 6 deletions userspace/libsinsp/mesos_auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ along with sysdig. If not, see <http://www.gnu.org/licenses/>.
#include "mesos_auth.h"

mesos_auth::mesos_auth(const uri::credentials_t& dcos_enterprise_credentials,
string auth_hostname,
int token_refresh_interval)
: m_dcos_enterprise_credentials(dcos_enterprise_credentials),
m_auth_uri("https://localhost/acs/api/v1/auth/login"),
m_auth_uri(string("https://") + auth_hostname + string("/acs/api/v1/auth/login")),
m_token_refresh_interval(token_refresh_interval),
m_last_token_refresh_s(0)

Expand All @@ -42,11 +43,6 @@ mesos_auth::~mesos_auth()
{
}

void mesos_auth::set_auth_hostname(string &hostname)
{
m_auth_uri.set_host(hostname);
}

string mesos_auth::get_token()
{
refresh_token();
Expand Down
3 changes: 1 addition & 2 deletions userspace/libsinsp/mesos_auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ class mesos_auth
{
public:
mesos_auth(const uri::credentials_t& dcos_enterprise_credentials = uri::credentials_t(),
string auth_hostname = "localhost",
int token_refresh_interval = DCOS_ENTERPRISE_TOKEN_REFRESH_S);
virtual ~mesos_auth();

void set_auth_hostname(string &hostname);

virtual void refresh_token();

// Return the current token. The token may expire at any time
Expand Down

0 comments on commit f216efe

Please sign in to comment.