13
13
import org .apache .ecs .html .Table ;
14
14
import org .owasp .webgoat .session .ECSFactory ;
15
15
import org .owasp .webgoat .session .WebSession ;
16
- import org .owasp .webgoat .util .WebGoatI18N ;
17
16
18
17
19
18
/***************************************************************************************************
@@ -102,12 +101,12 @@ protected Element doStage1(WebSession s) throws Exception
102
101
{
103
102
if (headerName .length () > 0 && !headerName .equalsIgnoreCase (AUTHORIZATION ))
104
103
{
105
- s .setMessage (WebGoatI18N .get ("BasicAuthHeaderNameIncorrect" ));
104
+ s .setMessage (getLabelManager () .get ("BasicAuthHeaderNameIncorrect" ));
106
105
}
107
106
if (headerValue .length () > 0
108
107
&& !(headerValue .equals ("guest:guest" ) || headerValue .equals ("webgoat:webgoat" )))
109
108
{
110
- s .setMessage (WebGoatI18N .get ("BasicAuthHeaderValueIncorrect" ));
109
+ s .setMessage (getLabelManager () .get ("BasicAuthHeaderValueIncorrect" ));
111
110
112
111
}
113
112
}
@@ -121,8 +120,8 @@ protected Element doStage1(WebSession s) throws Exception
121
120
122
121
TR row1 = new TR ();
123
122
TR row2 = new TR ();
124
- row1 .addElement (new TD (new StringElement (WebGoatI18N .get ("BasicAuthenticationWhatIsNameOfHeader" ))));
125
- row2 .addElement (new TD (new StringElement (WebGoatI18N .get ("BasicAuthenticationWhatIsDecodedValueOfHeader" ))));
123
+ row1 .addElement (new TD (new StringElement (getLabelManager () .get ("BasicAuthenticationWhatIsNameOfHeader" ))));
124
+ row2 .addElement (new TD (new StringElement (getLabelManager () .get ("BasicAuthenticationWhatIsDecodedValueOfHeader" ))));
126
125
127
126
row1 .addElement (new TD (new Input (Input .TEXT , HEADER_NAME , headerName .toString ())));
128
127
row2 .addElement (new TD (new Input (Input .TEXT , HEADER_VALUE , headerValue .toString ())));
@@ -133,7 +132,7 @@ protected Element doStage1(WebSession s) throws Exception
133
132
ec .addElement (t );
134
133
ec .addElement (new P ());
135
134
136
- Element b = ECSFactory .makeButton (WebGoatI18N .get ("Submit" ));
135
+ Element b = ECSFactory .makeButton (getLabelManager () .get ("Submit" ));
137
136
ec .addElement (b );
138
137
139
138
} catch (Exception e )
@@ -159,7 +158,7 @@ protected Element doStage2(WebSession s) throws Exception
159
158
getLessonTracker (s , originalUser ).setStage (1 );
160
159
getLessonTracker (s , originalUser ).store (s , this );
161
160
makeSuccess (s );
162
- s .setMessage (WebGoatI18N .get ("BasicAuthenticiationGreenStars1" )+ originalUser + WebGoatI18N .get ("BasicAuthenticationGreenStars2" ));
161
+ s .setMessage (getLabelManager () .get ("BasicAuthenticiationGreenStars1" )+ originalUser + getLabelManager () .get ("BasicAuthenticationGreenStars2" ));
163
162
return ec ;
164
163
}
165
164
else
@@ -185,36 +184,36 @@ protected Element doStage2(WebSession s) throws Exception
185
184
getLessonTracker (s , BASIC ).store (s , this , BASIC );
186
185
}
187
186
188
- s .setMessage (WebGoatI18N .get ("BasicAuthenticationStage1Completed" ));
187
+ s .setMessage (getLabelManager () .get ("BasicAuthenticationStage1Completed" ));
189
188
190
189
// If the auth header is different but still the original user - tell the user
191
190
// that the original cookie was posted bak and basic auth uses the cookie before the
192
191
// authorization token
193
192
if (!originalAuth .equals ("" ) && !originalAuth .equals (s .getHeader (AUTHORIZATION )))
194
193
{
195
194
ec
196
- .addElement (WebGoatI18N .get ("BasicAuthenticationAlmostThere1" )
195
+ .addElement (getLabelManager () .get ("BasicAuthenticationAlmostThere1" )
197
196
+ AUTHORIZATION
198
- + WebGoatI18N .get ("BasicAuthenticationAlmostThere2" )
197
+ + getLabelManager () .get ("BasicAuthenticationAlmostThere2" )
199
198
+ s .getUserName ()
200
- + WebGoatI18N .get ("BasicAuthenticationAlmostThere3" ));
199
+ + getLabelManager () .get ("BasicAuthenticationAlmostThere3" ));
201
200
}
202
201
else if (!originalSessionId .equals (s .getCookie (JSESSIONID )))
203
202
{
204
203
ec
205
- .addElement (WebGoatI18N .get ("BasicAuthenticationReallyClose" ));
204
+ .addElement (getLabelManager () .get ("BasicAuthenticationReallyClose" ));
206
205
207
206
}
208
207
else
209
208
{
210
- ec .addElement (WebGoatI18N .get ("BasicAuthenticationUseTheHints" ));
209
+ ec .addElement (getLabelManager () .get ("BasicAuthenticationUseTheHints" ));
211
210
}
212
211
213
212
}
214
213
215
214
} catch (Exception e )
216
215
{
217
- s .setMessage (WebGoatI18N .get ("ErrorGenerating" ) + this .getClass ().getName ());
216
+ s .setMessage (getLabelManager () .get ("ErrorGenerating" ) + this .getClass ().getName ());
218
217
e .printStackTrace ();
219
218
}
220
219
@@ -245,18 +244,18 @@ public List<String> getHints(WebSession s)
245
244
// switch ( stage )
246
245
// {
247
246
// case 1:
248
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint1" ));
249
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint2" ));
250
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint3" ));
251
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint4" ));
247
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint1" ));
248
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint2" ));
249
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint3" ));
250
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint4" ));
252
251
253
252
// break;
254
253
// case 2:
255
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint5" ));
256
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint6" ));
257
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint7" ));
258
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint8" ));
259
- hints .add (WebGoatI18N .get ("BasicAuthenticationHint9" ));
254
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint5" ));
255
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint6" ));
256
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint7" ));
257
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint8" ));
258
+ hints .add (getLabelManager () .get ("BasicAuthenticationHint9" ));
260
259
261
260
// break;
262
261
// }
0 commit comments