Book a Demo
Prev Next

SetAuthorisation

Inputs

Parameter

Details

parameters

  • C++: const char*
  • C#: string

A JSON string of parameters. Available fields are:

  • username
  • password
  • accessToken - OAuth access token

Outputs via Callbacks

[Optional] LogMessage or SetError - to provide user feedback.

Details

This method receives authorisation information that the user enters within Enterprise Architect.

It consists of either username:password credentials or an OAuth access token.

Enterprise Architect will call SetAuthorisation at the start of each session (e.g. open System Integration, open a model, or change user). Use the values provided for any calls to the external provider.

Do not store these as 'static' in any way. Storing as simple members is OK as a new instance of this Class will be created for each new session.

Example Implementation

void ExampleIntegrationPlugin::SetAuthorisation(const char* parameters)

{

LogMessage(LOG_TRACE, __FUNCTION__);

Json::Value jsonParameters;

if (strlen(parameters))

{

std::stringstream(parameters) >> jsonParameters;

}

m_username = jsonParameters["username"].asString(); // If basic authorisation is used.

m_password = jsonParameters["password"].asString();

m_accessToken = jsonParameters["accessToken"].asString(); // If OAuth is used.

}