REST API access to organizations

Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:20:58 +0000.
Sender:Carl Partridge.
Date:Friday, 21 August 2015 13:22:47 UTC+1.

Firstly, thanks for providing Tyk as Open Source!

We’re investigating the use of Tyk to provide a gateway to our API, which will be white-labelled for several organisations.

At the moment, we’re investigating just the case where we install Tyk Gateway (i.e. not the dashboard), mainly because the dashboard is closed source.

In this case, how would we create/update Organisations via the Tyk Gateway REST API? (create, list, modify, delete) ? We can only find instructions for doing this via the Advanced REST API, which I believe is part of the closed source dashboard. This seems like a pretty basic requirement for configuring the gateway via REST - so have I missed something?

Carl

Imported Google Group message.
Sender:Martin Buhr.
Date:Friday, 21 August 2015 15:35:12 UTC+1.

Hi Carl,

The gateway has no actual “knowledge” of organisations, in the gateway, Orgs are an abstract concept and only exist through a session token that sits in a slightly different namespace, and that object solely exists to manage quotas. There is no object structure or heirarchy.

The documentation for adding these quotas is here: https://tyk.io/v1.7/rest-api/organisation_quotas/

If you create an organisation object like this, and apply the same ID to an API definition, and also apply the same organisation ID to the user token object then you’ve created a link between those things and Tyk will behave accordingly if you configure it to (as in, manage org quotas). Though it won’t secure the API from being accessed by another key with a different ORG ID, because access rgihts are handled by an explicit access rights section in the token, there is no “ownership”.

This set up is very intentional, Tyk gateway nodes are designed to be spartan, they are meant to be “dumb” and resilient, and most of all, do what they are told without cruft. Out of the box a tyk node runs on it’s own with only a redis db, no mongo or anything else required. It’s meant to be a functional unit in a wider, more complex infrastructure setup, if you want to add heirarchies to it, then that needs to be done elsewhere, because the “unit” just routes traffic according to rules you give it.

having a spartan gateway means there’s less that can go wrong, and it can be more resillient to high traffic.

The dashboard actually imposes a lot of structure (as well a centralised data repository) on top of a Tyk cluster, and with that: workflows, ownership and granular access rights at an API owner / admin level. Since Tyk can be used in a myiriad of ways, the dashboard offers one way of structuring access for a large deployment.

For example, with tyk there are no granular acces rights that allow different admin users access to a specific subset of APIs, tokens and policies, nor can you enable/disable admin API keys because there is no such concept, there is only a single key - the node secret, and you would never expose that outside of your ops team because it is meant for orchestration… by things like the dashboard :wink:

The advanced management API provides this additional security layer that allows programatic, granular, administrative automation & integration access with an organisation → user heirarchy, while the gateway has a very raw API that is mainly meant for deeper integration with wider infrastructure systems.

The point here is that Tyk is a versatile component, if you want to add heirarchies and segregation to it, you can use the dashboard, or write your own logic and impose it on your Tyk cluster. Many people do this simply because they don’t need all the features of the dashboard, or they have their own portals, and means they can adapt the business logic around their business instead of being forced by the gateway to do something a certain way.

Hope that clarifies the design philosophy a little.

Cheers,
Martin

Imported Google Group message.
Sender:Carl Partridge.
Date:Friday, 21 August 2015 15:35:12 UTC+1.

Hi Carl,

The gateway has no actual “knowledge” of organisations, in the gateway, Orgs are an abstract concept and only exist through a session token that sits in a slightly different namespace, and that object solely exists to manage quotas. There is no object structure or heirarchy.

The documentation for adding these quotas is here: https://tyk.io/v1.7/rest-api/organisation_quotas/

If you create an organisation object like this, and apply the same ID to an API definition, and also apply the same organisation ID to the user token object then you’ve created a link between those things and Tyk will behave accordingly if you configure it to (as in, manage org quotas). Though it won’t secure the API from being accessed by another key with a different ORG ID, because access rgihts are handled by an explicit access rights section in the token, there is no “ownership”.

This set up is very intentional, Tyk gateway nodes are designed to be spartan, they are meant to be “dumb” and resilient, and most of all, do what they are told without cruft. Out of the box a tyk node runs on it’s own with only a redis db, no mongo or anything else required. It’s meant to be a functional unit in a wider, more complex infrastructure setup, if you want to add heirarchies to it, then that needs to be done elsewhere, because the “unit” just routes traffic according to rules you give it.

having a spartan gateway means there’s less that can go wrong, and it can be more resillient to high traffic.

The dashboard actually imposes a lot of structure (as well a centralised data repository) on top of a Tyk cluster, and with that: workflows, ownership and granular access rights at an API owner / admin level. Since Tyk can be used in a myiriad of ways, the dashboard offers one way of structuring access for a large deployment.

For example, with tyk there are no granular acces rights that allow different admin users access to a specific subset of APIs, tokens and policies, nor can you enable/disable admin API keys because there is no such concept, there is only a single key - the node secret, and you would never expose that outside of your ops team because it is meant for orchestration… by things like the dashboard :wink:

The advanced management API provides this additional security layer that allows programatic, granular, administrative automation & integration access with an organisation → user heirarchy, while the gateway has a very raw API that is mainly meant for deeper integration with wider infrastructure systems.

The point here is that Tyk is a versatile component, if you want to add heirarchies and segregation to it, you can use the dashboard, or write your own logic and impose it on your Tyk cluster. Many people do this simply because they don’t need all the features of the dashboard, or they have their own portals, and means they can adapt the business logic around their business instead of being forced by the gateway to do something a certain way.

Hope that clarifies the design philosophy a little.

Cheers,
Martin

Imported Google Group message.
Sender:Martin Buhr.
Date:Friday, 21 August 2015 16:27:30 UTC+1.

Martin

That’s tremendously helpful, thanks for such a comprehensive reply!

Carl