Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
fd4db9b9
Commit
fd4db9b9
authored
11 years ago
by
Rob Adams
Browse files
Options
Downloads
Patches
Plain Diff
Add AuthTool command-line tool to create shared secret for challenge/response authentication
parent
d3fa485a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/sdnplatform/sync/client/AuthTool.java
+70
-0
70 additions, 0 deletions
src/main/java/org/sdnplatform/sync/client/AuthTool.java
src/main/java/org/sdnplatform/sync/client/SyncClient.java
+1
-1
1 addition, 1 deletion
src/main/java/org/sdnplatform/sync/client/SyncClient.java
with
71 additions
and
1 deletion
src/main/java/org/sdnplatform/sync/client/AuthTool.java
0 → 100644
+
70
−
0
View file @
fd4db9b9
package
org.sdnplatform.sync.client
;
import
java.io.Console
;
import
org.kohsuke.args4j.CmdLineException
;
import
org.kohsuke.args4j.CmdLineParser
;
import
org.kohsuke.args4j.Option
;
import
org.sdnplatform.sync.internal.config.AuthScheme
;
import
org.sdnplatform.sync.internal.util.CryptoUtil
;
/**
* Command-line tool for setting up authentication credentials
* @author readams
*/
public
class
AuthTool
{
protected
static
class
AuthToolSettings
{
@Option
(
name
=
"--help"
,
usage
=
"Show help"
)
protected
boolean
help
;
@Option
(
name
=
"--keyStorePath"
,
usage
=
"Path to JCEKS key store where credentials should "
+
"be stored"
,
required
=
true
)
protected
String
keyStorePath
;
@Option
(
name
=
"--keyStorePassword"
,
usage
=
"Password for key store"
)
protected
String
keyStorePassword
;
@Option
(
name
=
"--authScheme"
,
usage
=
"Auth scheme for which we should set up credentials"
,
required
=
true
)
protected
AuthScheme
authScheme
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
AuthToolSettings
settings
=
new
AuthToolSettings
();
CmdLineParser
parser
=
new
CmdLineParser
(
settings
);
try
{
parser
.
parseArgument
(
args
);
}
catch
(
CmdLineException
e
)
{
System
.
err
.
println
(
e
.
getMessage
());
parser
.
printUsage
(
System
.
err
);
System
.
exit
(
1
);
}
if
(
settings
.
help
)
{
parser
.
printUsage
(
System
.
err
);
System
.
exit
(
1
);
}
if
(
settings
.
keyStorePassword
==
null
)
{
Console
con
=
System
.
console
();
char
[]
password
=
con
.
readPassword
(
"Enter key store password: "
);
settings
.
keyStorePassword
=
new
String
(
password
);
}
switch
(
settings
.
authScheme
)
{
case
NO_AUTH:
System
.
err
.
println
(
"No credentials required for NO_AUTH"
);
break
;
case
CHALLENGE_RESPONSE:
CryptoUtil
.
writeSharedSecret
(
settings
.
keyStorePath
,
settings
.
keyStorePassword
,
CryptoUtil
.
secureRandom
(
16
));
System
.
out
.
println
(
"Wrote random 128-bit secret to "
+
settings
.
keyStorePath
);
break
;
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/org/sdnplatform/sync/client/SyncClient.java
+
1
−
1
View file @
fd4db9b9
...
...
@@ -436,7 +436,7 @@ public class SyncClient {
protected
static
class
SyncClientSettings
{
@Option
(
name
=
"--help"
,
usage
=
"S
erver hostname
"
)
usage
=
"S
how help
"
)
protected
boolean
help
;
@Option
(
name
=
"--hostname"
,
aliases
=
"-h"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment