Verified Commit b9c07c04 authored by Jakob Moser's avatar Jakob Moser
Browse files

Remove basic auth section in favor of expectUnauthorized state

parent b1270eda
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -71,6 +71,10 @@ components:
                    description: A category this service fits in. Can be used on the UI to display it in a different section.
                    type: string
                    readOnly: true
                expectUnauthorized:
                    type: boolean
                    readOnly: true
                    description: Whether the expected success status code is a 401 (i.e., this does not indicate being down, and 200 would be a problem).
            example:
                name: Website
                host: fachschaft.cl.uni-heidelberg.de
+2 −2
Original line number Diff line number Diff line
[
    {"name": "Automation", "host": "automation.fachschaft.cl.uni-heidelberg.de", "category": "auth"},
    {"name": "Automation", "host": "automation.fachschaft.cl.uni-heidelberg.de", "category": "public", "expectUnauthorized": true},
    {"name": "CDN", "host": "cdn.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Framadate", "host": "framadate.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "GitLab", "host": "gitlab.cl.uni-heidelberg.de", "category": "public@institute"},
@@ -17,6 +17,6 @@
    {"name": "Tacos", "host": "tacos.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Tickets", "host": "tickets.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Todo", "host": "todo.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Traefik", "host": "traefik.fachschaft.cl.uni-heidelberg.de", "category": "auth"},
    {"name": "Traefik", "host": "traefik.fachschaft.cl.uni-heidelberg.de", "category": "public", "expectUnauthorized": true},
    {"name": "Website", "host": "fachschaft.cl.uni-heidelberg.de", "category": "public"}
]
+4 −0
Original line number Diff line number Diff line
@@ -45,6 +45,10 @@
            background-color: #ecca14;
        }

        .badge.orange span:last-child {
            background-color: #ec5300;
        }

        .badge.black span:last-child {
            background-color: black;
        }
+9 −4
Original line number Diff line number Diff line
@@ -3,9 +3,14 @@
 * (e.g. "Up") and a CSS color class (e.g. "green").
 *
 * @param {int?} statusCode An HTTP status code
 * @param {boolean?} expectUnauthorized Whether 401 should be counted as a success
 * @returns A list of the form ["Label", "color"]
 */
function getStatusInterpretation(statusCode) {
function getStatusInterpretation(statusCode, expectUnauthorized) {
    const accessibleResult = expectUnauthorized ? ["Up (unprotected)", "orange"] : ["Up", "green"]
    const authorizationNeededResult = expectUnauthorized ? ["Up", "green"] : ["Down", "red"]


    switch (statusCode) {
        case null:
        case undefined:
@@ -13,9 +18,9 @@ function getStatusInterpretation(statusCode) {
        case 200:
        case 301:
        case 302:
            return ["Up", "green"]
            return accessibleResult
        case 401:
            return ["Protected", "green"]
            return authorizationNeededResult
        default:
            return ["Down", "red"]
    }
@@ -47,7 +52,7 @@ export default {
        // Destructuring assignment: We know the method returns a list with two elements.
        // We want to do assign the first element to a const statusName, and the second to a const cssClass.
        // This can be done in a oneliner:
        const [statusName, cssClass] = getStatusInterpretation(service.status)
        const [statusName, cssClass] = getStatusInterpretation(service.status, service.expectUnauthorized)

        // Create an HTML hyperlink element of the form
        // <a href="https://fachschaft.cl.uni-heidelberg.de" class="badge green" target="_blank"></a>
+0 −9
Original line number Diff line number Diff line
@@ -16,15 +16,6 @@ export default {
                services: services.value
            }),
    
            m("h2", "Dienste hinter Basic-Auth"),
            m("p", 
                "Diese Dienste sollten zwar jederzeit aus dem Internet verfügbar sein, allerdings durch Basic-Auth geschützt. Falls sie das sind, werden sie hier grün markiert."
            ),
            m(StatusSection, {
                category: "auth",
                services: services.value
            }),
    
            m("h2", "Öffentliche Dienste des Instituts"),
            m("p", 
                "Auf diese Dienste haben wir als Fachschaft keinen Einfluss, denn sie werden vom Institut für Computerlinguistik betreiben. Falls sie aber auch down sind, spricht das dafür, dass gerade ein größeres Problem besteht."