Class VpnProfile
java.lang.Object
com.codename1.vpn.profile.VpnProfile
A VPN configuration: which server, which protocol, and how to prove who you are.
VpnProfile p = new VpnProfile("vpn.example.com")
.protocol(VpnProtocol.IKEV2)
.remoteIdentifier("vpn.example.com")
.localIdentifier("alice")
.usernamePassword("alice", secret)
.onDemand(true);
Credentials are handed over, not held
The username and password given here are passed to the platform, which
stores them in its own keychain and does not hand them back. getPassword()
therefore answers null for a profile that was loaded rather than built --
a loaded profile describes the configuration, not the secret.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondisplayName(String value) The name the user sees for this configuration in system settings.The name shown in system settings, or null.This client's identity, or null.The password, or null -- always null for a loaded profile, because the platform keeps the secret and does not return it.The tunnelling protocol.The server's identity, or null for the server address.The host name or address.The pre-shared key, or null.The username, or null.booleanWhether the tunnel comes up on demand.booleanWhether a secret was supplied when this profile was built.localIdentifier(String value) This client's identity.onDemand(boolean value) Whether the system should bring the tunnel up when traffic needs it.protocol(VpnProtocol value) The tunnelling protocol.remoteIdentifier(String value) The server's identity, as it appears in its certificate.sharedSecret(String value) Authenticates with a pre-shared key.usernamePassword(String user, String pass) Authenticates with a username and password.
-
Constructor Details
-
VpnProfile
Creates a profile for a server.- Parameters:
serverAddress- the host name or address, never null or empty
-
-
Method Details
-
protocol
The tunnelling protocol. Defaults toVpnProtocol.IKEV2. -
remoteIdentifier
The server's identity, as it appears in its certificate. Defaults to the server address. -
localIdentifier
This client's identity. -
usernamePassword
Authenticates with a username and password. -
onDemand
Whether the system should bring the tunnel up when traffic needs it. -
displayName
The name the user sees for this configuration in system settings. -
getServerAddress
The host name or address. -
getProtocol
The tunnelling protocol. -
getRemoteIdentifier
The server's identity, or null for the server address. -
getLocalIdentifier
This client's identity, or null. -
getUsername
The username, or null. -
getPassword
The password, or null -- always null for a loaded profile, because the platform keeps the secret and does not return it. -
isOnDemand
public boolean isOnDemand()Whether the tunnel comes up on demand. -
getDisplayName
The name shown in system settings, or null. -
isPasswordKnown
public boolean isPasswordKnown()Whether a secret was supplied when this profile was built.
Distinguishes "built without a password" from "loaded, and the platform kept the password", which
getPassword()alone cannot.
-