Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for security #68

Closed
pei0804 opened this issue Mar 12, 2018 · 3 comments
Closed

Add support for security #68

pei0804 opened this issue Mar 12, 2018 · 3 comments
Labels

Comments

@pei0804
Copy link
Member

pei0804 commented Mar 12, 2018

https://swagger.io/docs/specification/2-0/authentication/

@easonlin404 easonlin404 changed the title Add security Add support for security Mar 13, 2018
@pei0804
Copy link
Member Author

pei0804 commented Mar 24, 2018

I have idea and create now.

// @securityDefinitions.basic BasicAuth

// @securityDefinitions.apiKey ApiKeyAuth
// @in header
// @name Authorization

// @securityDefinitions.oauth2 OAuth2
// @flow accessCode
// @name Authorization
// @authorizationUrl https://example.com/oauth/authorize
// @tokenUrl https://example.com/oauth/token
// @scopes.read Grants read access
// @scopes.write Grants write access
// @scopes.admin Grants read and write access to administrative information

@pei0804
Copy link
Member Author

pei0804 commented Mar 26, 2018

I want.

{
    "security": [
        {
            "OAuth2Password": [
                "write",
                "read"
            ]
        },
        {
            "BasicAuth": []
        }
    ]
}

@pei0804
Copy link
Member Author

pei0804 commented Mar 26, 2018

// AddAccount godoc
// @Summary Add a account
// @Description add by json account
// @Accept  json
// @Produce  json
// @Param account body model.AddAccount true "Add account"
// @Success 200 {object} model.Account
// @Failure 400 {object} controller.HTTPError
// @Failure 404 {object} controller.HTTPError
// @Failure 500 {object} controller.HTTPError
// @Security  OAuth2Password[read, write]
// @Security  BasicAuth
// @Router /accounts [post]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants