Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAD-501: Log Bad VPN Configuration #96

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
currentVersion=1.0.6.10.SNAPSHOT
currentVersion=1.0.6.11.SNAPSHOT
9 changes: 9 additions & 0 deletions src/main/java/org/secureauth/sarestapi/ISAAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@

public interface ISAAccess {


/**
* <p>
* Returns IdP system information.
* </p>
* @return {@link org.secureauth.sarestapi.data.Response.SystemInfoResponse}
*/
SystemInfoResponse getSystemInfo();

/**
* <p>
* Returns IP Risk Evaluation from the Rest API
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/org/secureauth/sarestapi/SAAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ public SAAccess(SABaseURL saBaseURL, SAAuth saAuth, SAExecuter saExecuter){
this.saExecuter = saExecuter;
}


@Override
public SystemInfoResponse getSystemInfo() {
String ts = getServerTime();
String header = RestApiHeader.getAuthorizationHeader(saAuth, Resource.METHOD_GET, Resource.APPLIANCE_VERSION, ts);
try{
return saExecuter.executeGetRequest(header,saBaseURL.getApplianceURL() + Resource.APPLIANCE_VERSION,ts, SystemInfoResponse.class);
}catch (Exception e){
throw new SARestAPIException( e );
}
}

/**
* <p>
* Returns IP Risk Evaluation from the Rest API
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.secureauth.sarestapi.data.Response;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.secureauth.sarestapi.data.SystemInfo.SysInfo;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;

/**
*
*/
@XmlRootElement
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SystemInfoResponse extends BaseResponse{

private SysInfo sysInfo;

public SysInfo getSysInfo() {
return sysInfo;
}

public void setSysInfo(SysInfo sysInfo) {
this.sysInfo = sysInfo;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.secureauth.sarestapi.data.SystemInfo;

import com.fasterxml.jackson.annotation.JsonProperty;

public class CloudInfo{
@JsonProperty("license_package")
private String license;
@JsonProperty("sa_risk_provider")
private boolean riskProvider;

public String getLicense() {
return license;
}

public void setLicense(String license) {
this.license = license;
}

public boolean isRiskProvider() {
return riskProvider;
}

public void setRiskProvider(boolean riskProvider) {
this.riskProvider = riskProvider;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.secureauth.sarestapi.data.SystemInfo;


import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

public class IdsInfo{
@JsonProperty("ids_hosts")
private List<String> idsHost;

public List<String> getIdsHost() {
return idsHost;
}

public void setIdsHost(List<String> idsHost) {
this.idsHost = idsHost;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.secureauth.sarestapi.data.SystemInfo;

public class RealmSysInfo {
private int realmId;
private Version version;
private Version productVersion;
private Summary hotfixSummary;

public int getRealmId() {
return realmId;
}

public void setRealmId(int realmId) {
this.realmId = realmId;
}

public Version getVersion() {
return version;
}

public void setVersion(Version version) {
this.version = version;
}

public Version getProductVersion() {
return productVersion;
}

public void setProductVersion(Version productVersion) {
this.productVersion = productVersion;
}

public Summary getHotfixSummary() {
return hotfixSummary;
}

public void setHotfixSummary(Summary hotfixSummary) {
this.hotfixSummary = hotfixSummary;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.secureauth.sarestapi.data.SystemInfo;

public class Summary{
private int patchLevel;
private boolean patched;

public int getPatchLevel() {
return patchLevel;
}

public void setPatchLevel(int patchLevel) {
this.patchLevel = patchLevel;
}

public boolean getPatched() {
return patched;
}

public void setPatched(boolean patched) {
this.patched = patched;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.secureauth.sarestapi.data.SystemInfo;

import com.fasterxml.jackson.annotation.JsonProperty;

public class SysInfo{
private RealmSysInfo realmSysInfo;
private String deploymentType;
@JsonProperty("cloud_sysinfo")
private CloudInfo cloudInfo;
@JsonProperty("ids_info")
private IdsInfo idsList;

public CloudInfo getCloudInfo() {
return cloudInfo;
}

public void setCloudInfo(CloudInfo cloudInfo) {
this.cloudInfo = cloudInfo;
}

public IdsInfo getIdsList() {
return idsList;
}

public void setIdsList(IdsInfo idsList) {
this.idsList = idsList;
}

public RealmSysInfo getRealmSysInfo() {
return realmSysInfo;
}

public void setRealmSysInfo(RealmSysInfo realmSysInfo) {
this.realmSysInfo = realmSysInfo;
}

public String getDeploymentType() {
return deploymentType;
}

public void setDeploymentType(String deploymentType) {
this.deploymentType = deploymentType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.secureauth.sarestapi.data.SystemInfo;

public class Version{
private String majorVersion;
private String minorVersion;
private String buildVersion;

public String printableVersion(){
return majorVersion + "." + minorVersion + "." + buildVersion;
}

public String getMajorVersion() {
return majorVersion;
}

public void setMajorVersion(String majorVersion) {
this.majorVersion = majorVersion;
}

public String getMinorVersion() {
return minorVersion;
}

public void setMinorVersion(String minorVersion) {
this.minorVersion = minorVersion;
}

public String getBuildVersion() {
return buildVersion;
}

public void setBuildVersion(String buildVersion) {
this.buildVersion = buildVersion;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class Resource {

public static final String API_VERSION = "v1";
public static final String API_VERSION_2 = "v2";
public static final String API_VERSION_3 = "v3";
public static final String HTTPS = "https://";
public static final String HTTP = "http://";
public static final String COLON = ":";
Expand All @@ -33,6 +34,7 @@ public class Resource {
public static final String APPLIANCE_AUTH_LINK="/api/"+ API_VERSION +"/auth/link/";
public static final String APPLIANCE_AAUTH="/api/"+ API_VERSION +"/adaptauth";
public static final String APPLIANCE_USERS="/api/"+ API_VERSION + "/users/";
public static final String APPLIANCE_SYSINFO = "api/"+ API_VERSION_3 + "/sysinfo";
public static final String APPLIANCE_AUTHENTICATED = "/api/" + API_VERSION_2 + "/authenticated";
public static final String APPLIANCE_IDM_USERS="/users/";
public static final String APPLIANCE_IDM_USERS_PASSWD_RESET="/resetpwd";
Expand All @@ -55,6 +57,7 @@ public class Resource {
public static final String APPLIANCE_OTP_VALIDATE=APPLIANCE_OTP + "/validate";
public static final String APPLIANCE_THROTTLE = "/throttle";
public static final String APPLIANCE_STATUS = "/status";
public static final String APPLIANCE_VERSION = APPLIANCE_SYSINFO + "/ping";


public static final String STATUS_INVALID="invalid";
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/org/secureauth/sarestapi/resources/SAExecuter.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ public <T> T executeGetRequestStateful(String auth, Cookie ingressCookie, String
response.close();
return genericResponse;
} catch (Exception e) {
logger.error("Exception Get Request: \nQuery:\n\t" + query + "\nError:" + e.getMessage());
throw e;
throw new SARestAPIException("Exception Get Request: \nQuery:\n\t" + query + "\nError:" + e.getMessage());
}
}

Expand All @@ -166,15 +165,12 @@ public <T> T executeGetRequest(String auth, String query, String userId, String
header("Authorization", auth).
header("X-SA-Ext-Date", ts).
get();
//consider using response.ok(valueType).build(); instead.
genericResponse = response.readEntity(valueType);
response.close();
return genericResponse;
} catch (Exception e) {
logger.error("Exception Get Request: \nQuery:\n\t" + query + "\nError:" + e.getMessage());
throw new SARestAPIException("Exception Get Request: \nQuery:\n\t" + query + "\nError:" + e.getMessage(), e);
}

return genericResponse;

}

private String encodedValue(String value) throws UnsupportedEncodingException {
Expand Down