/*
Swisscom Safe Connect
Copyright (C) 2014 Swisscom
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.swisscom.safeconnect.utils;
import org.strongswan.android.data.VpnProfile;
import org.strongswan.android.data.VpnType;
/**
* Created by cianci on 22.04.14.
*/
public class VpnConfigurator {
public static VpnProfile getVpnProfile(String username, String password, String psk){
VpnProfile profile = new VpnProfile();
profile.setName(Config.VPN_NAME);
profile.setGateway(Config.VPN_ADDR);
profile.setVpnType(VpnType.IKEV2_EAP);
//if (VpnType.IKEV2_EAP.getRequiresUsernamePassword())
//{
profile.setUsername(username);
password = password.isEmpty() ? null : password;
profile.setPassword(password);
//}
profile.setPsk(psk);
profile.setServerAuth(Config.SERVER_AUTH);
String certAlias = null;
profile.setCertificateAlias(certAlias);
return profile;
}
}