mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 23:18:27 +02:00
feat: add JWT Support to MDM and refacture (MESSENGER-6162)
This commit is contained in:
@@ -226,37 +226,15 @@ struct AuthenticationServerSelectionScreen: View {
|
||||
}
|
||||
|
||||
private func isHomeserverAddressValid(_ homeserverAddress: String) async -> Bool {
|
||||
|
||||
// bwi #6162 a homeserveraddress is valid when there is either
|
||||
// a) no homeserver protection (bwm)
|
||||
// b) tokenized protection and there is a valid token
|
||||
// c) hashed protection and there is a valid hash (this will be disabled soon)
|
||||
// d) b) && c) can be combined for now
|
||||
if !BWIBuildSettings.shared.bwiEnableTokenizedLoginProtection && !BWIBuildSettings.shared.bwiEnableLoginProtection {
|
||||
return true
|
||||
}
|
||||
|
||||
var validHomeserver = false
|
||||
|
||||
if BWIBuildSettings.shared.bwiEnableTokenizedLoginProtection {
|
||||
|
||||
let tokenVerificator = ServerTokenVerificator()
|
||||
|
||||
let token = await tokenVerificator.fetchToken(baseURL: homeserverAddress)
|
||||
|
||||
if let token = token {
|
||||
validHomeserver = tokenVerificator.verifyToken(baseURL: homeserverAddress, token: token)
|
||||
}
|
||||
}
|
||||
|
||||
if BWIBuildSettings.shared.bwiEnableLoginProtection && !validHomeserver {
|
||||
|
||||
if BWIBuildSettings.shared.bwiEnableLoginProtection || BWIBuildSettings.shared.bwiEnableTokenizedLoginProtection {
|
||||
let protectionService = LoginProtectionService()
|
||||
protectionService.hashes = BWIBuildSettings.shared.bwiHashes
|
||||
|
||||
validHomeserver = protectionService.isValid(homeserverAddress)
|
||||
return await protectionService.isValid(homeserverAddress)
|
||||
}
|
||||
|
||||
return validHomeserver
|
||||
return true
|
||||
}
|
||||
|
||||
/// bwi: jump directly into the iOS settings app to allow camera access
|
||||
|
||||
Reference in New Issue
Block a user