mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +02:00
adds pomerium version to the user info endpoint (#3093)
* adds pomerium version to the user info endpoint * linting * order imports
This commit is contained in:
parent
0bb47ed190
commit
351f562c42
5 changed files with 30 additions and 4 deletions
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/pomerium/pomerium/internal/sessions"
|
||||
"github.com/pomerium/pomerium/internal/telemetry/trace"
|
||||
"github.com/pomerium/pomerium/internal/urlutil"
|
||||
"github.com/pomerium/pomerium/internal/version"
|
||||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
||||
"github.com/pomerium/pomerium/pkg/grpc/directory"
|
||||
|
@ -575,6 +576,7 @@ func (a *Authenticate) userInfo(w http.ResponseWriter, r *http.Request) error {
|
|||
WebAuthnCreationOptions: creationOptions,
|
||||
WebAuthnRequestOptions: requestOptions,
|
||||
WebAuthnURL: urlutil.WebAuthnURL(r, authenticateURL, state.sharedKey, r.URL.Query()),
|
||||
PomeriumVersion: version.FullVersion(),
|
||||
}).ServeHTTP(w, r)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ type UserInfoData struct {
|
|||
WebAuthnCreationOptions *webauthn.PublicKeyCredentialCreationOptions
|
||||
WebAuthnRequestOptions *webauthn.PublicKeyCredentialRequestOptions
|
||||
WebAuthnURL string
|
||||
PomeriumVersion string
|
||||
}
|
||||
|
||||
// ToJSON converts the data into a JSON map.
|
||||
|
@ -52,6 +53,7 @@ func (data UserInfoData) ToJSON() map[string]interface{} {
|
|||
m["webAuthnCreationOptions"] = data.WebAuthnCreationOptions
|
||||
m["webAuthnRequestOptions"] = data.WebAuthnRequestOptions
|
||||
m["webAuthnUrl"] = data.WebAuthnURL
|
||||
m["pomeriumVersion"] = data.PomeriumVersion
|
||||
return m
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,12 @@ import UserInfoPage from "./components/UserInfoPage";
|
|||
import WebAuthnRegistrationPage from "./components/WebAuthnRegistrationPage";
|
||||
import { SubpageContextProvider } from "./context/Subpage";
|
||||
import { createTheme } from "./theme";
|
||||
import { PageData } from "./types";
|
||||
import {PageData, UserInfoPageData} from "./types";
|
||||
import Box from "@mui/material/Box";
|
||||
import CssBaseline from "@mui/material/CssBaseline";
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import React, { FC } from "react";
|
||||
import {get} from "lodash";
|
||||
|
||||
const theme = createTheme();
|
||||
|
||||
|
@ -54,7 +55,7 @@ const App: FC = () => {
|
|||
<ToolbarOffset />
|
||||
</Box>
|
||||
</Box>
|
||||
<Footer />
|
||||
<Footer pomeriumVersion={get(data, 'pomeriumVersion')} />
|
||||
</SubpageContextProvider>
|
||||
</ThemeProvider>
|
||||
);
|
||||
|
|
|
@ -4,7 +4,11 @@ import React, { FC } from "react";
|
|||
import {FooterLink} from "./FooterLink";
|
||||
import AppBar from "@mui/material/AppBar";
|
||||
|
||||
const Footer: FC = () => {
|
||||
type FooterData = {
|
||||
pomeriumVersion?: string;
|
||||
}
|
||||
|
||||
const Footer: FC<FooterData> = ({pomeriumVersion}) => {
|
||||
return (
|
||||
<AppBar
|
||||
position="fixed"
|
||||
|
@ -20,7 +24,10 @@ const Footer: FC = () => {
|
|||
justifyContent="center"
|
||||
sx={{
|
||||
fontSize: "0.85rem",
|
||||
padding: "16px",
|
||||
paddingLeft: "16px",
|
||||
paddingRight: "16px",
|
||||
paddingBottom: "8px",
|
||||
paddingTop: "16px",
|
||||
}}
|
||||
>
|
||||
<Box>
|
||||
|
@ -45,6 +52,19 @@ const Footer: FC = () => {
|
|||
</FooterLink>
|
||||
</Box>
|
||||
</Stack>
|
||||
{!!pomeriumVersion && (
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={2}
|
||||
justifyContent="center"
|
||||
sx={{
|
||||
paddingBottom: "6px",
|
||||
fontSize: "0.85rem",
|
||||
}}
|
||||
>
|
||||
<Box><b>Pomerium Version:</b> {pomeriumVersion}</Box>
|
||||
</Stack>
|
||||
)}
|
||||
</AppBar>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -115,6 +115,7 @@ export type UserInfoPageData = BasePageData & {
|
|||
webAuthnCreationOptions?: WebAuthnCreationOptions;
|
||||
webAuthnRequestOptions?: WebAuthnRequestOptions;
|
||||
webAuthnUrl?: string;
|
||||
pomeriumVersion: string;
|
||||
};
|
||||
|
||||
export type WebAuthnRegistrationPageData = BasePageData & {
|
||||
|
|
Loading…
Add table
Reference in a new issue