Skip to content

Commit

Permalink
added non-nls for strings that do not need to be translated
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWittmann committed Mar 31, 2014
1 parent ded4b69 commit 2d83362
Show file tree
Hide file tree
Showing 49 changed files with 469 additions and 469 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public Jboss7SAMLAssertionFactory() {
*/
@Override
public boolean accept() {
String property = System.getProperty("jboss.server.config.dir");
String property = System.getProperty("jboss.server.config.dir"); //$NON-NLS-1$
if (property != null) {
File f = new File(property, "standalone.xml");
File f = new File(property, "standalone.xml"); //$NON-NLS-1$
if (f.isFile())
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ public SAMLBearerTokenLoginModule() {
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState,
Map<String, ?> options) {
super.initialize(subject, callbackHandler, sharedState, options);
String val = (String) options.get("allowedIssuers");
String val = (String) options.get("allowedIssuers"); //$NON-NLS-1$
if (val != null) {
String [] split = val.split(",");
String [] split = val.split(","); //$NON-NLS-1$
for (String issuer : split) {
if (issuer != null && issuer.trim().length() > 0)
allowedIssuers.add(issuer);
}
}
signatureRequired = (String) options.get("signatureRequired");
keystorePath = (String) options.get("keystorePath");
keystorePassword = (String) options.get("keystorePassword");
keyAlias = (String) options.get("keyAlias");
keyPassword = (String) options.get("keyPassword");
signatureRequired = (String) options.get("signatureRequired"); //$NON-NLS-1$
keystorePath = (String) options.get("keystorePath"); //$NON-NLS-1$
keystorePassword = (String) options.get("keystorePassword"); //$NON-NLS-1$
keyAlias = (String) options.get("keyAlias"); //$NON-NLS-1$
keyPassword = (String) options.get("keyPassword"); //$NON-NLS-1$
}

/**
Expand All @@ -117,12 +117,12 @@ public void initialize(Subject subject, CallbackHandler callbackHandler, Map<Str
public boolean login() throws LoginException {
try {
HttpServletRequest request = getCurrentRequest();
String authorization = request.getHeader("Authorization");
if (authorization != null && authorization.startsWith("Basic")) {
String authorization = request.getHeader("Authorization"); //$NON-NLS-1$
if (authorization != null && authorization.startsWith("Basic")) { //$NON-NLS-1$
String b64Data = authorization.substring(6);
byte[] dataBytes = Base64.decodeBase64(b64Data);
String data = new String(dataBytes, "UTF-8");
if (data.startsWith("SAML-BEARER-TOKEN:")) {
String data = new String(dataBytes, "UTF-8"); //$NON-NLS-1$
if (data.startsWith("SAML-BEARER-TOKEN:")) { //$NON-NLS-1$
String assertionData = data.substring(18);
Document samlAssertion = DocumentUtil.getDocument(assertionData);
SAMLAssertionParser parser = new SAMLAssertionParser();
Expand All @@ -131,7 +131,7 @@ public boolean login() throws LoginException {
Object parsed = parser.parse(xmlEventReader);
AssertionType assertion = (AssertionType) parsed;
SAMLBearerTokenUtil.validateAssertion(assertion, request, allowedIssuers);
if ("true".equals(signatureRequired)) {
if ("true".equals(signatureRequired)) { //$NON-NLS-1$
KeyPair keyPair = getKeyPair(assertion);
if (!SAMLBearerTokenUtil.isSAMLAssertionSignatureValid(samlAssertion, keyPair)) {
throw new LoginException("Invalid signature found on SAML assertion!");
Expand Down Expand Up @@ -160,13 +160,13 @@ private HttpServletRequest getCurrentRequest() throws LoginException {
HttpServletRequest request = HttpRequestThreadLocalValve.TL_request.get();
if (request == null) {
try {
request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); //$NON-NLS-1$
} catch (Exception e) {
request = null;
}
}
if (request == null) {
throw new LoginException("Failed to get current HTTP request.");
throw new LoginException("Failed to get current HTTP request."); //$NON-NLS-1$
}
return request;
}
Expand Down Expand Up @@ -196,7 +196,7 @@ private KeyStore loadKeystore() throws LoginException {
return SAMLBearerTokenUtil.loadKeystore(keystorePath, keystorePassword);
} catch (Exception e) {
e.printStackTrace();
throw new LoginException("Error loading signature keystore: " + e.getMessage());
throw new LoginException("Error loading signature keystore: " + e.getMessage()); //$NON-NLS-1$
}
}

Expand All @@ -217,7 +217,7 @@ private void consumeAssertion(AssertionType assertion) throws Exception {
AttributeStatementType attrStatement = (AttributeStatementType) statement;
List<ASTChoiceType> attributes = attrStatement.getAttributes();
for (ASTChoiceType astChoiceType : attributes) {
if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) {
if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) { //$NON-NLS-1$
List<Object> values = astChoiceType.getAttribute().getAttributeValue();
for (Object roleValue : values) {
if (roleValue != null) {
Expand All @@ -244,7 +244,7 @@ protected Principal getIdentity() {
@Override
protected Group[] getRoleSets() throws LoginException {
Group[] groups = new Group[1];
groups[0] = new SimpleGroup("Roles");
groups[0] = new SimpleGroup("Roles"); //$NON-NLS-1$
try {
for (String role : roles) {
groups[0].addMember(createIdentity(role));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ public static void main(String [] args) {
*/
protected static void storePassword(Options options) throws Exception {
System.out.println("Storing a password in the password vault.");
String vaultdir = options.cmdLineOptions.get("vaultdir");
String keystore = options.cmdLineOptions.get("keystore");
String storepass = options.cmdLineOptions.get("storepass");
String alias = options.cmdLineOptions.get("alias");
String salt = options.cmdLineOptions.get("salt");
String count = options.cmdLineOptions.get("count");
String block = options.cmdLineOptions.get("block");
String name = options.cmdLineOptions.get("name");
String password = options.cmdLineOptions.get("password");
String propertyfile = options.cmdLineOptions.get("propertyfile");
String property = options.cmdLineOptions.get("property");
String vaultdir = options.cmdLineOptions.get("vaultdir"); //$NON-NLS-1$
String keystore = options.cmdLineOptions.get("keystore"); //$NON-NLS-1$
String storepass = options.cmdLineOptions.get("storepass"); //$NON-NLS-1$
String alias = options.cmdLineOptions.get("alias"); //$NON-NLS-1$
String salt = options.cmdLineOptions.get("salt"); //$NON-NLS-1$
String count = options.cmdLineOptions.get("count"); //$NON-NLS-1$
String block = options.cmdLineOptions.get("block"); //$NON-NLS-1$
String name = options.cmdLineOptions.get("name"); //$NON-NLS-1$
String password = options.cmdLineOptions.get("password"); //$NON-NLS-1$
String propertyfile = options.cmdLineOptions.get("propertyfile"); //$NON-NLS-1$
String property = options.cmdLineOptions.get("property"); //$NON-NLS-1$

if (vaultdir == null || keystore == null || storepass == null || salt == null
|| alias == null || count == null || name == null || password == null
Expand Down Expand Up @@ -127,21 +127,21 @@ protected static void storePassword(Options options) throws Exception {
protected static void addUser(Options options) throws Exception {
System.out.println("Adding an Overlord user.");

String configdir = options.cmdLineOptions.get("configdir");
String vaultdir = options.cmdLineOptions.get("vaultdir");
String keystore = options.cmdLineOptions.get("keystore");
String storepass = options.cmdLineOptions.get("storepass");
String alias = options.cmdLineOptions.get("alias");
String salt = options.cmdLineOptions.get("salt");
String count = options.cmdLineOptions.get("count");
String user = options.cmdLineOptions.get("user");
String password = options.cmdLineOptions.get("password");
String roles = options.cmdLineOptions.get("roles");
String propertyfile = options.cmdLineOptions.get("propertyfile");
String property = options.cmdLineOptions.get("property");

String block = "overlord";
String name = user + ".password";
String configdir = options.cmdLineOptions.get("configdir"); //$NON-NLS-1$
String vaultdir = options.cmdLineOptions.get("vaultdir"); //$NON-NLS-1$
String keystore = options.cmdLineOptions.get("keystore"); //$NON-NLS-1$
String storepass = options.cmdLineOptions.get("storepass"); //$NON-NLS-1$
String alias = options.cmdLineOptions.get("alias"); //$NON-NLS-1$
String salt = options.cmdLineOptions.get("salt"); //$NON-NLS-1$
String count = options.cmdLineOptions.get("count"); //$NON-NLS-1$
String user = options.cmdLineOptions.get("user"); //$NON-NLS-1$
String password = options.cmdLineOptions.get("password"); //$NON-NLS-1$
String roles = options.cmdLineOptions.get("roles"); //$NON-NLS-1$
String propertyfile = options.cmdLineOptions.get("propertyfile"); //$NON-NLS-1$
String property = options.cmdLineOptions.get("property"); //$NON-NLS-1$

String block = "overlord"; //$NON-NLS-1$
String name = user + ".password"; //$NON-NLS-1$

if (vaultdir == null || keystore == null || storepass == null || salt == null
|| alias == null || count == null || user == null || password == null) {
Expand Down Expand Up @@ -172,16 +172,16 @@ protected static void addUser(Options options) throws Exception {
* @param configdir
*/
private static void createUser(String user, String roles, String vaultHash, String configdir) throws Exception {
File usersFile = new File(configdir, "overlord-idp-users.properties");
File rolesFile = new File(configdir, "overlord-idp-roles.properties");
File usersFile = new File(configdir, "overlord-idp-users.properties"); //$NON-NLS-1$
File rolesFile = new File(configdir, "overlord-idp-roles.properties"); //$NON-NLS-1$

FileWriter writer = null;
try {
writer = new FileWriter(usersFile, true);
writer.write(user);
writer.write("=");
writer.write("="); //$NON-NLS-1$
writer.write(vaultHash);
writer.write("\n");
writer.write("\n"); //$NON-NLS-1$
writer.flush();
} finally {
writer.close();
Expand All @@ -190,13 +190,13 @@ private static void createUser(String user, String roles, String vaultHash, Stri
try {
writer = new FileWriter(rolesFile, true);
writer.write(user);
writer.write("=");
writer.write("="); //$NON-NLS-1$
if (roles == null) {
writer.write("overlorduser,admin.sramp");
writer.write("overlorduser,admin.sramp"); //$NON-NLS-1$
} else {
writer.write("overlorduser,admin.sramp," + roles);
writer.write("overlorduser,admin.sramp," + roles); //$NON-NLS-1$
}
writer.write("\n");
writer.write("\n"); //$NON-NLS-1$
writer.flush();
} finally {
writer.close();
Expand Down Expand Up @@ -234,10 +234,10 @@ public static final Options parse(String [] args) throws Exception {
String et = args[0];
options.execType = ExecType.valueOf(et);
for (int i = 1; i < args.length; i++) {
if (args[i].startsWith("-")) {
if (args[i].startsWith("-")) { //$NON-NLS-1$
String key = args[i].substring(1);
String value = null;
if ( (i+1) < args.length && !args[i+1].startsWith("-")) {
if ( (i+1) < args.length && !args[i+1].startsWith("-")) { //$NON-NLS-1$
value = args[i+1];
}
options.cmdLineOptions.put(key, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Jetty8SAMLAssertionFactory() {
@Override
public boolean accept() {
try {
Class.forName("org.eclipse.jetty.server.Request");
Class.forName("org.eclipse.jetty.server.Request"); //$NON-NLS-1$
return true;
} catch (ClassNotFoundException e) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public void init(FilterConfig config) throws ServletException {
roleClasses = null;

// Role classes
String parameter = config.getInitParameter("roleClasses");
String parameter = config.getInitParameter("roleClasses"); //$NON-NLS-1$
if (parameter != null && parameter.trim().length() > 0) {
roleClasses = parameter.split(",");
roleClasses = parameter.split(","); //$NON-NLS-1$
} else {
roleClasses = defaultRoleClasses();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/
public class JettyAuthConstants {
public static final String [] ROLE_CLASSES = new String [] {
"org.eclipse.jetty.security.MappedLoginService$RolePrincipal",
"org.eclipse.jetty.plus.jaas.JAASRole",
"org.apache.karaf.jaas.boot.principal.RolePrincipal"
"org.eclipse.jetty.security.MappedLoginService$RolePrincipal", //$NON-NLS-1$
"org.eclipse.jetty.plus.jaas.JAASRole", //$NON-NLS-1$
"org.apache.karaf.jaas.boot.principal.RolePrincipal" //$NON-NLS-1$
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public SAMLBearerTokenLoginService() {
@Override
public UserIdentity login(String username, Object credentials) {
String password = credentials.toString();
if (password.startsWith("SAML-BEARER-TOKEN:")) {
if (password.startsWith("SAML-BEARER-TOKEN:")) { //$NON-NLS-1$
return doSamlLogin(username, password.substring(18));
} else {
return super.login(username, credentials);
Expand Down Expand Up @@ -155,7 +155,7 @@ private UserIdentity consumeAssertion(AssertionType assertion) throws Exception
AttributeStatementType attrStatement = (AttributeStatementType) statement;
List<ASTChoiceType> attributes = attrStatement.getAttributes();
for (ASTChoiceType astChoiceType : attributes) {
if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) {
if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) { //$NON-NLS-1$
List<Object> values = astChoiceType.getAttribute().getAttributeValue();
for (Object roleValue : values) {
if (roleValue != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ public boolean authenticate(Request request, HttpServletResponse response, Login
throws IOException {
Principal principal = request.getUserPrincipal();
if (principal == null) {
MessageBytes authorization = request.getCoyoteRequest().getMimeHeaders().getValue("authorization");
MessageBytes authorization = request.getCoyoteRequest().getMimeHeaders().getValue("authorization"); //$NON-NLS-1$
if (authorization != null) {
authorization.toBytes();
ByteChunk authorizationBC = authorization.getByteChunk();
if (authorizationBC.startsWithIgnoreCase("basic ", 0)) {
if (authorizationBC.startsWithIgnoreCase("basic ", 0)) { //$NON-NLS-1$
authorizationBC.setOffset(authorizationBC.getOffset() + 6);
String b64Data = new String(authorizationBC.getBuffer(), authorizationBC.getOffset(),
authorizationBC.getLength());
byte[] decoded = Base64.decodeBase64(b64Data);
String data = new String(decoded, "UTF-8");
if (data.startsWith("SAML-BEARER-TOKEN:")) {
String data = new String(decoded, "UTF-8"); //$NON-NLS-1$
if (data.startsWith("SAML-BEARER-TOKEN:")) { //$NON-NLS-1$
try {
String assertionData = data.substring(18);
Document samlAssertion = DocumentUtil.getDocument(assertionData);
Expand Down Expand Up @@ -167,7 +167,7 @@ private Principal consumeAssertion(AssertionType assertion) throws Exception {
AttributeStatementType attrStatement = (AttributeStatementType) statement;
List<ASTChoiceType> attributes = attrStatement.getAttributes();
for (ASTChoiceType astChoiceType : attributes) {
if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) {
if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) { //$NON-NLS-1$
List<Object> values = astChoiceType.getAttribute().getAttributeValue();
for (Object roleValue : values) {
if (roleValue != null) {
Expand All @@ -179,7 +179,7 @@ private Principal consumeAssertion(AssertionType assertion) throws Exception {
}
}

Principal identity = new GenericPrincipal(samlSubject, "", roles);
Principal identity = new GenericPrincipal(samlSubject, "", roles); //$NON-NLS-1$
return identity;
}

Expand All @@ -200,7 +200,7 @@ public void setAllowedIssuers(String allowedIssuers) {
}
this.allowedIssuers.clear();
if (allowedIssuers != null) {
String[] issuers = allowedIssuers.split(",");
String[] issuers = allowedIssuers.split(","); //$NON-NLS-1$
for (String issuer : issuers) {
this.allowedIssuers.add(issuer.trim());
}
Expand Down Expand Up @@ -235,10 +235,10 @@ public String getKeystorePath() {
public void setKeystorePath(String keystorePath) {
keystorePath = interpolate(keystorePath);
// Handle relative path - always relative to catalina.home
if (keystorePath != null && !keystorePath.startsWith("/") && keystorePath.charAt(2) != ':') {
String home = System.getProperty("catalina.home");
if (keystorePath != null && !keystorePath.startsWith("/") && keystorePath.charAt(2) != ':') { //$NON-NLS-1$
String home = System.getProperty("catalina.home"); //$NON-NLS-1$
if (home != null) {
keystorePath = home + "/" + keystorePath;
keystorePath = home + "/" + keystorePath; //$NON-NLS-1$
}
}
this.keystorePath = keystorePath;
Expand Down Expand Up @@ -294,8 +294,8 @@ public void setKeyPassword(String keyPassword) {
* @param value
*/
private String interpolate(String value) {
if (value != null && value.startsWith("${")) {
int idx = value.indexOf("::");
if (value != null && value.startsWith("${")) { //$NON-NLS-1$
int idx = value.indexOf("::"); //$NON-NLS-1$
if (idx < 3) {
return value;
}
Expand Down
Loading

0 comments on commit 2d83362

Please sign in to comment.