1 19 20 package com.sslexplorer.webforwards; 21 22 import java.util.Calendar ; 23 import java.util.StringTokenizer ; 24 25 import com.sslexplorer.core.CoreEvent; 26 27 28 31 public abstract class AbstractAuthenticatingWebForward extends AbstractWebForward { 32 33 private String authenticationUsername; 34 private String authenticationPassword; 35 private String preferredAuthenticationScheme; 36 private String formType = WebForwardTypes.FORM_SUBMIT_NONE; 37 private String formParameters = ""; 38 39 public AbstractAuthenticatingWebForward(int realmID, int id, int type, String destinationURL, String shortName, String description, 40 String category, String authenticationUsername, 41 String authenticationPassword, String preferredAuthenticationScheme, 42 String formType, String formParameters, Calendar dateCreated, Calendar dateAmended) { 43 super(realmID, id, type, destinationURL, shortName, description, category, dateCreated, dateAmended); 44 this.authenticationUsername = authenticationUsername; 45 this.authenticationPassword = authenticationPassword; 46 this.preferredAuthenticationScheme = preferredAuthenticationScheme; 47 this.formParameters = formParameters; 48 this.formType = formType; 49 } 50 51 57 public String getAuthenticationUsername() { 58 return authenticationUsername; 59 } 60 61 67 public String getAuthenticationPassword() { 68 return authenticationPassword; 69 } 70 71 80 public String getPreferredAuthenticationScheme() { 81 return preferredAuthenticationScheme; 82 } 83 84 90 public void setAuthenticationUsername(String authenticationUsername) { 91 this.authenticationUsername = authenticationUsername; 92 } 93 94 100 public void setAuthenticationPassword(String authenticationPassword) { 101 this.authenticationPassword = authenticationPassword; 102 } 103 104 112 public void setPreferredAuthenticationScheme(String preferredAuthenticationScheme) { 113 this.preferredAuthenticationScheme = preferredAuthenticationScheme; 114 } 115 116 119 public String getFormType() { 120 return formType; 121 } 122 123 126 public String getFormParameters() { 127 return formParameters; 128 } 129 130 133 public void setFormType(String formType) { 134 this.formType = formType; 135 } 136 137 140 public void setFormParameters(String formParameters) { 141 this.formParameters = formParameters; 142 } 143 144 public boolean paramsRequirePassword() { 145 if (!super.paramsRequirePassword()){ 146 if (authenticationPassword.contains("${session:password}") | formParameters.contains("${session:password}")){ 147 return true; 148 } 149 else{ 150 return false; 151 } 152 } 153 else{ 154 return false; 155 } 156 } 157 158 public void addFormParametersToEvent(CoreEvent evt, String key){ 159 int counter = 1; 160 StringTokenizer t = new StringTokenizer (this.formParameters, "\n"); 161 while (t.hasMoreElements()) { 162 String element = (String ) t.nextElement(); 163 evt.addAttribute(key+" "+counter, element); 164 counter++; 165 } 166 } 167 168 169 } 170 | Popular Tags |