getDomainTokens extracts domain token names from request and policy definitions. Returns empty strings if tokens cannot be found.
()
| 554 | // getDomainTokens extracts domain token names from request and policy definitions. |
| 555 | // Returns empty strings if tokens cannot be found. |
| 556 | func (e *Enforcer) getDomainTokens() (rDomainToken, pDomainToken string) { |
| 557 | if rAssertion, ok := e.model["r"]["r"]; ok && len(rAssertion.Tokens) > 1 { |
| 558 | rDomainToken = rAssertion.Tokens[1] |
| 559 | } |
| 560 | if pAssertion, ok := e.model["p"]["p"]; ok && len(pAssertion.Tokens) > 1 { |
| 561 | pDomainToken = pAssertion.Tokens[1] |
| 562 | } |
| 563 | return rDomainToken, pDomainToken |
| 564 | } |
| 565 | |
| 566 | // registerDomainMatchingFunc registers domain matching function if the matcher uses keyMatch for domains. |
| 567 | func (e *Enforcer) registerDomainMatchingFunc(ptype string) { |
no outgoing calls
no test coverage detected