Paperless / rebuild
Course 2 28ef273

AuthenticatedPrincipal.kt

paperless-backend/src/main/kotlin/at/fhtw/swen3/paperless/auth/model/AuthenticatedPrincipal.kt

Snapshot 28ef273Download original
1package at.fhtw.swen3.paperless.auth.model23import at.fhtw.swen3.paperless.exception.AuthenticationRequiredException4import java.util.UUID56object AuthenticatedPrincipal {78    fun userId(name: String?): UUID {9        val id = name?.let { runCatching { UUID.fromString(it) }.getOrNull() }10        if (name == null || id == null || !id.toString().equals(name, ignoreCase = true)) {11            throw AuthenticationRequiredException()12        }13        return id14    }15}16

Search chapters, reference and source filenames.