Commit 918a1005 authored by Jose Blaya's avatar Jose Blaya
Browse files

IKEv2 username authentication

parent 9b7c6bda
......@@ -29,6 +29,11 @@ public class IKEv2Profile: NetworkExtensionProfile {
return "IKEv2"
}
/// :nodoc:
public static var usernameAuthPrefix: String {
return "token_"
}
/// :nodoc:
public static var isTunnel: Bool {
return false
......@@ -146,11 +151,17 @@ public class IKEv2Profile: NetworkExtensionProfile {
/// :nodoc:
public func generatedProtocol(withConfiguration configuration: VPNConfiguration) -> NEVPNProtocol {
var iKEv2Username = IKEv2Profile.usernameAuthPrefix
if let username = Client.providers.accountProvider.publicUsername {
iKEv2Username += username
}
let cfg = NEVPNProtocolIKEv2()
cfg.serverAddress = configuration.server.hostname
cfg.remoteIdentifier = configuration.server.hostname
cfg.localIdentifier = configuration.username
cfg.username = configuration.username
cfg.localIdentifier = iKEv2Username
cfg.username = iKEv2Username
cfg.passwordReference = configuration.passwordReference
cfg.authenticationMethod = .none
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment