Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,24 @@ The LDAP config file should have the following contents:
poolMinIdle: 0
poolTestOnBorrow: true
```

## Web page permissions

By default, all pages are accessible to all roles.
To limit page access, you can set page permissions by pages
and `_` as separator field.

The following pages are available:
- `dashboard`
- `cluster`
- `resource-group`
- `selector`
- `history`

```yaml
# admin/api can access all pages, while user can only access dashboard/history
pagePermissions:
admin:
user: dashboard_history
api:
```
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public Response processRESTLogin()
public Response restUserinfo(@Context SecurityContext securityContext)
{
LbPrincipal principal = (LbPrincipal) securityContext.getUserPrincipal();
List<String> roles = List.of(principal.getMemberOf().orElse("").split("_"));
List<String> roles = List.of(principal.getMemberOf().map(String::toLowerCase).orElse("").split("_"));
List<String> pagePermissions;
if (formAuthManager != null) {
pagePermissions = formAuthManager.processPagePermissions(roles);
Expand Down
169 changes: 169 additions & 0 deletions gateway-ha/src/main/resources/static/assets/index-05SkmtNI.js

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions gateway-ha/src/main/resources/static/assets/index-DjKQuKRX.js

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions gateway-ha/src/main/resources/static/assets/index-LPSIbY_J.js

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions gateway-ha/src/main/resources/static/assets/index-aIgX_lG9.js

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions gateway-ha/src/main/resources/static/assets/index-uyYFzuRs.js

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions gateway-ha/src/main/resources/static/assets/index-ytwn7x7b.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gateway-ha/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Trino Gateway</title>
<script type="module" crossorigin src="/assets/index-d2L8ur2V.js"></script>
<script type="module" crossorigin src="/assets/index-DjKQuKRX.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-WjKhXYTT.css">
</head>
<body>
Expand Down
5 changes: 4 additions & 1 deletion webapp/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ErrorBoundary } from './components/error';
import {
HashRouter as Router,
Routes,
Route
Route,
Navigate
} from "react-router-dom";
import { Login } from './components/login';
import { RootLayout as Layout } from './components/layout';
Expand Down Expand Up @@ -48,6 +49,8 @@ function Screen() {
{routers.flatMap(router => {
return hasPagePermission(router, access) ? [<Route {...router.routeProps} key={router.itemKey} />] : [];
})}
{/* Landing page */}
<Route path="/" element={<Navigate to="/dashboard" />} />
{/* Default page */}
<Route path="*" element={<Home />} key={"*"} />
</Routes>
Expand Down
10 changes: 7 additions & 3 deletions webapp/src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const RootLayout = (props: {
}
}, [location]);

const lonout = () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

const logout = () => {
logoutApi({}).then(data => {
console.log(data);
access.updateToken("");
Expand Down Expand Up @@ -56,7 +56,11 @@ export const RootLayout = (props: {
className={styles.navigationHeaderLogo}
/>
),
text: "Trino Gateway",
text: (
<Link to="/" style={{ textDecoration: "none" }}>
Trino Gateway
</Link>
),
}}
footer={
<div className={styles.dIV}>
Expand All @@ -80,7 +84,7 @@ export const RootLayout = (props: {
render={
<Dropdown.Menu>
<Dropdown.Item onClick={() => { setUserProfile(true) }}>{Locale.Menu.Header.PersonalCenter}</Dropdown.Item>
<Dropdown.Item onClick={lonout}>{Locale.Menu.Header.Logout}</Dropdown.Item>
<Dropdown.Item onClick={logout}>{Locale.Menu.Header.Logout}</Dropdown.Item>
</Dropdown.Menu>
}
>
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export type RouterItems = (RouterItem | SubRouterItem)[]

export const routers: RouterItems = [
{
itemKey: '',
itemKey: 'dashboard',
text: Locale.Menu.Sider.Dashboard,
icon: <IconIntro className={styles.icon} />,
// Role.****
roles: [],
routeProps: {
path: '/',
path: '/dashboard',
element: < Dashboard />
},
},
Expand Down