Skip to content

Conversation

@xqbumu
Copy link
Contributor

@xqbumu xqbumu commented May 27, 2017

Add an authorization plugin that supports ACL, RBAC based on casbin.

It requires the built-in HTTP basic authentication by default, so the authz can get the user name and enforce the access control.

Test is also added in authz_test.go.

This PR is to solve: #931

@coveralls
Copy link

coveralls commented May 27, 2017

Coverage Status

Coverage decreased (-0.08%) to 83.858% when pulling 3a6c9db on xqbumu:middleware-authz into 3359eae on labstack:master.

@coveralls
Copy link

coveralls commented May 27, 2017

Coverage Status

Coverage increased (+0.1%) to 84.042% when pulling 43e804d on xqbumu:middleware-authz into 3359eae on labstack:master.

@coveralls
Copy link

coveralls commented May 27, 2017

Coverage Status

Coverage increased (+0.1%) to 84.042% when pulling 0bbe2ad on xqbumu:middleware-authz into 3359eae on labstack:master.

@vishr
Copy link
Member

vishr commented May 28, 2017

@xqbumu I appreciate your contribution to the project. The only concern is external dependencies and this was one of the reason I moved cookbook examples to labstack/echox. We can definitely work through this and find a home for it. Can you provide me casbin's external deps?

@hsluoyz
Copy link

hsluoyz commented May 29, 2017

Hi @vishr,

Casbin's external dep is only one: github.com/Knetic/govaluate

See here: https://godoc.org/github.com/casbin/casbin?imports

@vishr
Copy link
Member

vishr commented May 30, 2017

@xqbumu Thanks for the information. What do you think about renaming the prefix Authz to CasbinAuth? This will make it more clear.

Updated: I will also need some help to update middleware docs https://github.com/labstack/echox/tree/master/website/content/middleware - you can also provide a link to your docs as learn more.

@coveralls
Copy link

coveralls commented May 31, 2017

Coverage Status

Coverage increased (+0.1%) to 84.042% when pulling f53a65d on xqbumu:middleware-authz into 3359eae on labstack:master.

@coveralls
Copy link

coveralls commented May 31, 2017

Coverage Status

Coverage increased (+0.1%) to 84.042% when pulling 706db07 on xqbumu:middleware-authz into 3359eae on labstack:master.

@xqbumu xqbumu force-pushed the middleware-authz branch from 706db07 to 274dd39 Compare May 31, 2017 02:08
@coveralls
Copy link

coveralls commented May 31, 2017

Coverage Status

Coverage increased (+0.1%) to 84.042% when pulling 274dd39 on xqbumu:middleware-authz into 466d509 on labstack:master.

@xqbumu xqbumu force-pushed the middleware-authz branch from 274dd39 to 7044914 Compare May 31, 2017 02:37
@coveralls
Copy link

coveralls commented May 31, 2017

Coverage Status

Coverage increased (+0.1%) to 84.042% when pulling 7044914 on xqbumu:middleware-authz into 466d509 on labstack:master.

fix some coveralls check.
change test file with new rule.
renaming the prefix Authz to CasbinAuth
use built-in SetBasicAuth method in test file.
export all casbin auth configs.
@xqbumu xqbumu force-pushed the middleware-authz branch from 7044914 to 7096092 Compare May 31, 2017 04:04
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 84.059% when pulling 7096092 on xqbumu:middleware-authz into 466d509 on labstack:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 84.059% when pulling 7096092 on xqbumu:middleware-authz into 466d509 on labstack:master.

@vishr
Copy link
Member

vishr commented Jun 1, 2017

@xqbumu Will get it reviewed soon.

@coveralls
Copy link

coveralls commented Jun 1, 2017

Coverage Status

Coverage increased (+0.1%) to 84.042% when pulling 5f6c3e4 on xqbumu:middleware-authz into 466d509 on labstack:master.

@xqbumu
Copy link
Contributor Author

xqbumu commented Jun 1, 2017

@vishr thank you

@vishr vishr merged commit c73dd1f into labstack:master Jun 2, 2017
@vishr
Copy link
Member

vishr commented Jun 2, 2017

@xqbumu Thanks for your contribution.

@vishr
Copy link
Member

vishr commented Jun 2, 2017

@xqbumu I have moved casbin middlware to https://github.com/labstack/echo-contrib/tree/master/casbin. Please review in case if I have missed something.

@hsluoyz
Copy link

hsluoyz commented Jun 3, 2017

Hi @vishr , I found that the link you provided (https://github.com/labstack/echo-contrib/tree/master/casbin) is 404 for me:
image

any possible causes? Thanks.

@vishr
Copy link
Member

vishr commented Jun 3, 2017

@hsluoyz
Copy link

hsluoyz commented Jun 3, 2017

It works now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants