mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Implement login/logout commands
Refactor the auth code into its own dagger module, add tests and use the new interfaces to implement the login and logout commands. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=149108266
This commit is contained in:
parent
80f0910899
commit
5614760d53
10 changed files with 380 additions and 183 deletions
|
@ -125,11 +125,23 @@ final class RegistryCli {
|
|||
injectReflectively(RegistryToolComponent.class, component, command);
|
||||
|
||||
if (!(command instanceof RemoteApiCommand)) {
|
||||
// TODO(mmuller): this should be in the try/catch LoginRequiredException in case future
|
||||
// commands use our credential.
|
||||
command.run();
|
||||
return;
|
||||
}
|
||||
|
||||
AppEngineConnection connection = component.appEngineConnection();
|
||||
// Get the App Engine connection, advise the user if they are not currently logged in..
|
||||
AppEngineConnection connection;
|
||||
try {
|
||||
connection = component.appEngineConnection();
|
||||
} catch (AuthModule.LoginRequiredException ex) {
|
||||
System.err.println("===================================================================");
|
||||
System.err.println("You must login using 'nomulus login' prior to running this command.");
|
||||
System.err.println("===================================================================");
|
||||
return;
|
||||
}
|
||||
|
||||
if (command instanceof ServerSideCommand) {
|
||||
((ServerSideCommand) command).setConnection(connection);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue