I have 1 usecase, some thing like: - for urls matc...
# talk-oathkeeper
s
I have 1 usecase, some thing like: • for urls match /abc/clients --> use Oauth2 client to authenticate • for urls match /abc/** --> use cookie to authenticate can I use access rule like this? in this case, order of rules is matter (it need to check rule company:protected1 first), does rule checking of oathkeeper have this order sensitive?
Copy code
-
 id: "company:protected1"
 match:
  url: "<https://company/><{abc/clients/**}>"
  methods:
   - GET
   - POST
   - PUT
   - DELETE
 authenticators:
  -
   handler: oauth2_client_credentials
 authorizer:
  handler: allow

-
 id: "company:protected2"
 match:
  url: "<https://company/><{abc/**}>"
  methods:
   - GET
   - POST
   - PUT
   - DELETE
 authenticators:
  -
   handler: cookie_session
 authorizer:
  handler: allow
 mutators:
  - handler: header
s
you can't have conflicting rules in oathkeeper
it will complain that more than one rule matches
s
is there any best practice for us to exclude 1 pattern from url match, @steep-lamp-91158? Rule
company:protected1
, I can rewrite it to:
Copy code
url: "<https://company/><{abc/clients/*}>"
For
company:protected2
, I don't know exactly what I can rewrite, the reason I use ** here because it can match url
abc/xyz
or url
abc/def/ccc
s
you will have to use different, i.e. non-conflicting routes
s
what's about this one, @steep-lamp-91158?
Copy code
-
 id: "company:protected1"
 match:
  url: "<https://company/abc/clients/><{**}>"
  methods:
   - GET
   - POST
   - PUT
   - DELETE
 authenticators:
  -
   handler: oauth2_client_credentials
 authorizer:
  handler: allow

-
 id: "company:protected2"
 match:
  url: "<https://company/abc/[!clients]><{**}>"
  methods:
   - GET
   - POST
   - PUT
   - DELETE
 authenticators:
  -
   handler: cookie_session
 authorizer:
  handler: allow
 mutators:
  - handler: header
what's the meaning of
<>
? I checked glob pattern but they don't mention anything about it
s
have a look here: https://www.ory.sh/oathkeeper/docs/api-access-rules it has many examples
s
thank @steep-lamp-91158, it works 🙂