oidc: Display error if applicable

This commit is contained in:
TwiN 2022-01-02 19:15:32 -05:00
parent 425c1d3674
commit 56048725e4
5 changed files with 11 additions and 4 deletions

View File

@ -124,7 +124,7 @@ func (c *OIDCConfig) callbackHandler(w http.ResponseWriter, r *http.Request) {
} }
} }
log.Printf("[security][callbackHandler] Subject %s is not in the list of allowed subjects", idToken.Subject) log.Printf("[security][callbackHandler] Subject %s is not in the list of allowed subjects", idToken.Subject)
http.Redirect(w, r, "/login?error=access_denied", http.StatusFound) http.Redirect(w, r, "/?error=access_denied", http.StatusFound)
} }
func (c *OIDCConfig) setSessionCookie(w http.ResponseWriter, idToken *oidc.IDToken) { func (c *OIDCConfig) setSessionCookie(w http.ResponseWriter, idToken *oidc.IDToken) {

View File

@ -11,6 +11,12 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="$route && $route.query.error" class="text-red-500 text-center my-2">
<div class="text-xl">
<span class="text-red-500" v-if="$route.query.error === 'access_denied'">You do not have access to this status page</span>
<span class="text-red-500" v-else>{{ $route.query.error }}</span>
</div>
</div>
<div v-if="config && config.oidc && !config.authenticated"> <div v-if="config && config.oidc && !config.authenticated">
<a :href="`${SERVER_URL}/oidc/login`" class="max-w-lg mx-auto w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-lg text-white bg-green-700 hover:bg-green-800"> <a :href="`${SERVER_URL}/oidc/login`" class="max-w-lg mx-auto w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-lg text-white bg-green-700 hover:bg-green-800">
Login with OIDC Login with OIDC
@ -57,6 +63,7 @@ export default {
}, },
data() { data() {
return { return {
error: '',
retrievedConfig: false, retrievedConfig: false,
config: { oidc: false, authenticated: true }, config: { oidc: false, authenticated: true },
tooltip: {}, tooltip: {},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long