Web-based responsive document annotation tool
Name | Summary |
---|---|
ErrorCode | Enum representing detailed errors which are more granular than just the http status codeenum class ErrorCode |
HttpAuthentication | Inspiration: https://www.sparkpost.com/docs/tech-resources/webhook-authentication/sealed class HttpAuthentication |
HttpErrorResponse | Data class to return on an http error, which can have a more detailed errorCode explaining the reason for the status codedata class HttpErrorResponse |
Name | Summary |
---|---|
ForbiddenException | Custom exception indicating the user is not authorized properly (missing role), will be used to return appropriate http error codeclass ForbiddenException : HttpErrorException |
GoneException | Exception indicating that a resource is gone, will be used through StatusPages feature to return the proper status code when this exception is thrownclass GoneException : HttpErrorException |
HttpErrorException | Base exception for HTTP errors, can optionally include a detailed http erroropen class HttpErrorException : RuntimeException |
UnauthorizedException | Custom exception indicating the user is not authenticated properly (missing / invalid auth token), will be used to return appropriate http error codeclass UnauthorizedException : HttpErrorException |
Name | Summary |
---|---|
getMessageString | Given a message key and optionally a locale, return the message string. If the locale is missing, use the default locale (english)fun getMessageString(key: String , locale: Locale ? = null): String |
isTokenStillValid | Validate JWT token, either accept the token as valid by configuration or call the configured authentication servicesuspend fun isTokenStillValid(client: HttpClient, jwt: String ): Boolean |
jwtFromHeader | Extract the JWT Base64 string from the request header or throw UnauthorizedException if missingfun jwtFromHeader(call: ApplicationCall): String |
measureTimeMillis | Higher order helper function to measure and log the execution time of the passed function while returning the result of the functionfun <T> measureTimeMillis(loggingFunction: ( Long ) -> Unit , function: () -> T): T |
validateRole | Top level function to validate the roles for a JWTfun validateRole(jwt: String , requiredRoles: List < String >, onlyOneMustMatch: Boolean = false): Boolean |