Skip to Content.
Sympa Menu

perfsonar-dev - r1904 - in trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType: db/mysql security

Subject: perfsonar development work

List archive

r1904 - in trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType: db/mysql security


Chronological Thread 
  • From:
  • To:
  • Subject: r1904 - in trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType: db/mysql security
  • Date: Mon, 15 Jan 2007 02:35:27 -0500

Author: uros
Date: 2007-01-15 02:35:26 -0500 (Mon, 15 Jan 2007)
New Revision: 1904

Modified:

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/db/mysql/MySqlManager.java

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security/Credentials.java
Log:
Working on credentials.

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/db/mysql/MySqlManager.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/db/mysql/MySqlManager.java
2007-01-11 23:54:25 UTC (rev 1903)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/db/mysql/MySqlManager.java
2007-01-15 07:35:26 UTC (rev 1904)
@@ -83,7 +83,7 @@
+ "?user=" + username
+ "&password=" + password
+ "&useUnicode=true&characterEncoding=UTF-8";
- System.out.println("url='" + url + "'");
+ //System.out.println("url='" + url + "'");

return getConnection(url);


Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security/Credentials.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security/Credentials.java
2007-01-11 23:54:25 UTC (rev 1903)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security/Credentials.java
2007-01-15 07:35:26 UTC (rev 1904)
@@ -7,6 +7,7 @@
package org.perfsonar.service.measurementPoint.tracefileCaptureType.security;

import
org.perfsonar.service.measurementPoint.tracefileCaptureType.db.SqlManager;
+import
org.perfsonar.service.measurementPoint.tracefileCaptureType.db.mysql.MySqlManager;

import java.sql.Connection;
import java.sql.Statement;
@@ -16,6 +17,9 @@
import java.util.EnumSet;
import java.util.List;
import java.util.ArrayList;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.PrintStream;

/**
* This class provides access to user credentials (authentication and
@@ -629,6 +633,17 @@

}

+ /**
+ * Helper method to print out sampling data.
+ *
+ * @param out
+ */
+ public void printOut(PrintStream out) {
+
+ out.println("\t\tType: '" + type.getType() + "'");
+ out.println("\t\tThreshold: " + threshold);
+ }
+
}

/**
@@ -1059,7 +1074,70 @@
}


+ /**
+ * Helper method to print out currently containing credentials.
+ *
+ * @param out
+ */
+ public void printOut(PrintStream out) {
+
+ out.println("Username: '" + username + "'");
+ out.println("Password: '" + password + "'");
+ out.println("Role: '" + role + "'");
+
+ out.println("Header filters:");
+ int i = 1;
+ for (String hf : headerFilters)
+ out.println("\t" + (i++) + ". '" + hf + "'");
+
+ out.println("Payload filters:");
+ i = 1;
+ for (String pf : payloadFilters)
+ out.println("\t" + (i++) + ". '" + pf + "'");
+
+ out.println("Sampling:");
+ i = 1;
+ for (Sampling s : samplings) {
+
+ out.println("\t" + (i++) + ".");
+ s.printOut(out);
+
+ }
+/*
+TODO
+ private Anonymization[] anonymizations = null;
+*/
+ }

+
+ /**
+ * Test main method, which tries to read in the credentials for the
+ * command line specified username and password and prints them out
+ * to stdout using printOut function.
+ */
+ public static void main(String[] args) throws Exception {
+
+ BufferedReader reader =
+ new BufferedReader(new InputStreamReader(System.in));
+ System.out.println("Enter required data to check credentials for:");
+ System.out.print("Username: ");
+ String username = reader.readLine();
+ System.out.print("Password: ");
+ String password = reader.readLine();
+ System.out.print("Checking credentials for username '" + username
+ + "', password '" + password + "' ...");
+ SqlManager sqlManager = new MySqlManager();
+ Credentials creds = new Credentials(
+ sqlManager, "127.0.0.1", "3306", "gn2_jra1_tcmp",
+ "tcmp", "odEldxcVyk0wq5zr");
+ Credentials userCreds = creds.getCredentials(username, password);
+ System.out.println("\nGot the following credentials:");
+ userCreds.printOut(System.out);
+
+ }
+
+
+
// ---------------------------------- private methods





  • r1904 - in trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType: db/mysql security, svnlog, 01/15/2007

Archive powered by MHonArc 2.6.16.

Top of Page