github.com/circl-dev/go-swagger@v0.31.0/examples/composed-auth/restapi/doc.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Package restapi Composing authorizations 4 // 5 // This sample API demonstrates how to compose several authentication schemes 6 // and configure complex security requirements for your operations. 7 // 8 // This API simulates a very simple market place with customers and resellers 9 // of items. 10 // 11 // Personas: 12 // - as a first time user, I want to see all items on sales 13 // - as a registered customer, I want to post orders for items and 14 // consult my past orders 15 // - as a registered reseller, I want to see all pending orders on the items 16 // I am selling on the market place 17 // - as a reseller managing my own inventories, I want to post replenishment orders for the items I provide 18 // - as a register user, I want to consult my personal account infos 19 // 20 // The situation we defined on the authentication side is as follows: 21 // - every known user is authenticated using a basic token 22 // - resellers are authenticated using API keys - we let the option to authenticate using a header or query param 23 // - any registered user (customer or reseller) will add a signed JWT to access more API endpoints 24 // 25 // Obviously, there are several ways to achieve the same result. We just wanted to demonstrate here how 26 // security requirements may compose several schemes. 27 // 28 // Note that we used the "OAuth2" declaration here but don't implement a real 29 // OAuth2 workflow: our intend here is just to be able to extract scopes from a passed JWT token (the 30 // only way to manipulate scoped authorizers with Swagger 2.0 is to declare them with type "oauth2"). 31 // 32 // Schemes: 33 // http 34 // Host: localhost 35 // BasePath: /api 36 // Version: 0.0.1 37 // 38 // Consumes: 39 // - application/json 40 // 41 // Produces: 42 // - application/json 43 // 44 // swagger:meta 45 package restapi