IsAuthorized Service Extension
isAuthorizedSE is an optional service extension that can be used on its own or in addition to rules to determine if a user is authorized. When both rules and isAuthorizedSE are configured, a user will be authorized if both the rules and the isAuthorizedSE evaluate to true.
#### Headers
`headers` define the HTTP [headers](/docs/proxy-local-development#headers) for a given policy location. The headers defined at the policy-level will override headers of the same name that are defined at the app-level.
### Logout
`logout` defines the optional logout settings for the application. When an application logout occurs, a user will be logged out of all the IDPs defined in policy for the app that the user is authenticated with. Additionally, all session data that is cached related to the app will be deleted.
The app-specific logout endpoint has some important differences from the [single logout (SLO)](/v1/docs/single-logout-slo) endpoint. Specifically, the SLO endpoint logs the user out of all authenticated IDPs whereas the app-specific logout will only log a user out of IDPs defined in the policies for the given app.
If an IDP is shared across multiple apps, the user will be logged out of the shared IDP. However, Maverics will still respect the session for the apps that weren't logged out of. That is, the user would not have to reauthenticate against apps that weren't logged out of explicitly.
#### Logout URL
`logoutURL` is the endpoint that will be exposed to facilitate a logout for application users.
#### Post Logout Redirect URL
`postLogoutRedirectURL` is the address where a user will be redirected after a successful logout.
### Load Attributes Service Extension
`loadAttrsSE` is an optional service extension used to customize how the loading of attributes is done. This extension is often used to load attributes from proprietary data sources such as enterprise APIs.
### ModifyRequest Service Extension
`modifyRequestSE` is an optional service extension that can be used to modify every request that passes through the app.
### ModifyResponse Service Extension
`modifyResponseSE` is an optional service extension that can be used to modify every response that passes through the app.
### Upstream Login
`upstreamLogin` is an optional configuration used to determine if a request to an upstream application is authenticated and to be able to log in to an upstream app. Such situations are common when an app manages its own sessions or directly authenticates against a backing data store like LDAP or a relational database.
#### IsLoggedIn Service Extension
`isLoggedInSE` is used to determine if an upstream application has been logged into.
#### Login Service Extension
`loginSE` is used to log in to an upstream application.
### Handle Unauthorized Service Extension
`handleUnauthorizedSE` is an optional service extension that can be used to override the default behavior when a policy evaluation denies access to the app.
## Example
### Standard Configuration
```yaml
apps:
- name: exampleProxyApp
type: proxy
routePatterns:
- app.example.com
- www.example.com/app/
upstream: https://app-internal.example.com
tls: exampleAppTLS
unauthorizedPage: https://app.example.com/unauthorized
attrProviders:
- name: ldap
usernameMapping: "{{ azure.emailaddress }}"
headers:
- name: SM_USER
value: "{{ azure.emailaddress }}"
- name: groups
value: "{{ ldap.memberOf }}"
- name: Organization
value: Example Inc.
policies:
- location: /
decision:
lifetime: 1m
authentication:
allowUnauthenticated: false
idps:
- azure
authorization:
allowAll: false
isAuthorizedSE:
funcName: IsAuthorized
file: /etc/maverics/auth.go
rulesAggregationMethod: and
rules:
- and:
- equals: ["{{ ldap.department }}", "Engineering"]
- notEquals: ["{{ ldap.title }}", "Junior Software Engineer"]
- contains: ["{{ ldap.memberOf }}", "cn=admins,ou=groups,ou=example,ou=com"]
- or:
- contains: ["{{ azure.emailaddress }}", "@example.com"]
- contains: ["{{ azure.emailaddress }}", "@example.io"]
- or:
- equals: ["{{ http.request.method }}", "GET"]
- equals: ["{{ http.request.method }}", "OPTIONS"]
- location: /index.html
authentication:
allowUnauthenticated: false
idps:
- azure
authorization:
allowAll: true
headers:
- name: firstName
value: "{{ ldap.givenname }}"
- name: lastName
value: "{{ ldap.sn }}"
- location: ~ \.(jpg|png|ico|svg|ttf|js|css|gif)$
authentication:
allowUnauthenticated: true
authorization:
allowAll: true
- location: