How to use Basic Authentication with RAML 1.0?


#1

I try to describe my API in RAML 1.0 which uses Basic Authentication. I use two different users (or groups) with different access rights. The RAML spec mentions to support Basic Authentication but doesn’t state any details. I tried definitions similar than those for OAuth 2.0 like “basic_authentication: !include securitySchemes/basic_authentication.raml” and “basic: !include securitySchemes/basic.raml” but according to API Workbench those are wrong. I could find some example regarding RAML 0.8 but don’t know how to adapt it to RAML 1.0.

I would be very much appreciated if somebody could provide a simple example how to use Basic Authentication, ideally with two different users/groups. Thanks a lot.


#2

There is an example in the spec:

#%RAML 1.0
title: Dropbox API
version: 1
baseUri: https://api.dropbox.com/{version}
securitySchemes:
  basic:
    description: |
      This API supports Basic Authentication.
    type: Basic Authentication

And the spec also describes that the basic authentication has no further facets that you can define. That means the above example should basically be fully enough.


#3

Thank you. So there is no way to express different users or groups each with different permissions?


#4

Maybe that helps you a bit http://forums.raml.org/t/allow-get-endpoint-to-be-both-secure-and-un-secure/1134/4


#5

There are vary good example in Raml spec you can check them out.
https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/