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 OAuth access token.

Enterprise Architect will call SetAuthorisation at the start of each session (eg: open System Integration, open a model, 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.

}