add frontend code from #3033

This commit is contained in:
viehlieb 2024-03-01 14:24:14 +01:00
parent 5f521c0982
commit e7fc94d5b5
8 changed files with 3662 additions and 4407 deletions

View File

@ -18,5 +18,5 @@ package frontend
import "embed"
//go:embed dist
// go:embed dist
var Files embed.FS

File diff suppressed because it is too large Load Diff

View File

@ -11,14 +11,17 @@ export function getRedirectUrlFromCurrentFrontendPath(provider: IProvider): stri
export const redirectToProvider = (provider: IProvider) => {
console.log({provider})
const redirectUrl = getRedirectUrlFromCurrentFrontendPath(provider)
const state = createRandomID(24)
localStorage.setItem('state', state)
window.location.href = `${provider.authUrl}?client_id=${provider.clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=openid email profile&state=${state}`
let scope = 'openid email profile'
if (provider.scope !== null){
scope = provider.scope
}
window.location.href = `${provider.authUrl}?client_id=${provider.clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=${scope}&state=${state}`
}
export const redirectToProviderOnLogout = (provider: IProvider) => {
if (provider.logoutUrl.length > 0) {
window.location.href = `${provider.logoutUrl}`

View File

@ -9,6 +9,7 @@ export interface ITeam extends IAbstract {
description: string
members: ITeamMember[]
right: Right
oidcId: string
createdBy: IUser
created: Date

View File

@ -13,6 +13,7 @@ export default class TeamModel extends AbstractModel<ITeam> implements ITeam {
description = ''
members: ITeamMember[] = []
right: Right = RIGHTS.READ
oidcId = ''
createdBy: IUser = {} // FIXME: seems wrong
created: Date = null

View File

@ -4,4 +4,5 @@ export interface IProvider {
authUrl: string;
clientId: string;
logoutUrl: string;
scope: string;
}

View File

@ -4,7 +4,7 @@
:class="{ 'is-loading': teamService.loading }"
>
<card
v-if="userIsAdmin"
v-if="userIsAdmin && !team.oidcId"
class="is-fullwidth"
:title="title"
>
@ -77,7 +77,7 @@
:padding="false"
>
<div
v-if="userIsAdmin"
v-if="userIsAdmin && !team.oidcId"
class="p-4"
>
<div class="field has-addons">

View File

@ -17,11 +17,13 @@
class="teams box"
>
<li
v-for="team in teams"
:key="team.id"
v-for="t in teams"
:key="t.id"
>
<router-link :to="{name: 'teams.edit', params: {id: team.id}}">
{{ team.name }}
<router-link :to="{name: 'teams.edit', params: {id: t.id}}">
<p>
{{ t.name + (t.oidcId ? ` (sso: ${t.oidcId})`: '') }}
</p>
</router-link>
</li>
</ul>