Browse files

Bulk application of code formatting, rather than having other commits…

… break
  • Loading branch information...
1 parent 07d6343 commit e835e935ba61e36094f5882afda31ade19d5ea9f @justinsb justinsb committed Apr 14, 2012
Showing with 9,066 additions and 8,878 deletions.
  1. +1 −1 auth/client/src/main/java/org/openstack/keystone/auth/client/Keystone.java
  2. +100 −97 auth/client/src/main/java/org/openstack/keystone/auth/client/KeystoneAuthenticationClient.java
  3. +7 −7 auth/client/src/main/java/org/openstack/keystone/auth/client/KeystoneAuthenticationException.java
  4. +34 −32 auth/client/src/main/java/org/openstack/keystone/auth/client/KeystoneAuthenticationToken.java
  5. +44 −44 auth/client/src/main/java/org/openstack/keystone/auth/client/KeystoneAuthenticator.java
  6. +3 −3 auth/client/src/main/java/org/openstack/keystone/service/AccountId.java
  7. +1 −1 auth/client/src/main/java/org/openstack/keystone/service/AuthenticationTokenValidator.java
  8. +44 −43 auth/client/src/main/java/org/openstack/keystone/service/DevelopmentTokenValidator.java
  9. +34 −34 auth/client/src/main/java/org/openstack/keystone/service/KeystoneAuthentication.java
  10. +71 −69 auth/client/src/main/java/org/openstack/keystone/service/KeystoneTokenValidator.java
  11. +73 −72 auth/client/src/main/java/org/openstack/keystone/service/OpenstackAuthenticationFilterBase.java
  12. +73 −72 auth/client/src/main/java/org/openstack/keystone/service/RestfulClient.java
  13. +2 −2 auth/client/src/main/java/org/platformlayer/auth/AuthenticationToken.java
  14. +3 −3 auth/client/src/main/java/org/platformlayer/auth/Authenticator.java
  15. +7 −7 auth/client/src/main/java/org/platformlayer/auth/OpenstackAuthenticationException.java
  16. +104 −100 auth/client/src/main/java/org/platformlayer/auth/test/OpenstackAuthenticationClient.java
  17. +12 −12 auth/client/src/main/java/org/platformlayer/auth/test/OpenstackAuthenticationToken.java
  18. +12 −12 auth/keystone-api/src/main/java/org/openstack/keystone/services/AuthenticationInfo.java
  19. +7 −7 auth/keystone-api/src/main/java/org/openstack/keystone/services/AuthenticatorException.java
  20. +3 −3 auth/keystone-api/src/main/java/org/openstack/keystone/services/GenericAuthenticator.java
  21. +1 −1 auth/keystone-api/src/main/java/org/openstack/keystone/services/GroupMembershipOracle.java
  22. +16 −16 auth/keystone-api/src/main/java/org/openstack/keystone/services/SystemAuthenticatorAdaptor.java
  23. +16 −16 auth/keystone-api/src/main/java/org/openstack/keystone/services/UserAuthenticatorAdaptor.java
  24. +31 −31 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/KeystoneCli.java
  25. +66 −63 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/KeystoneCliOptions.java
  26. +14 −13 ...stone-cli/src/main/java/org/platformlayer/keystone/cli/autocomplete/ProjectNameAutoCompleter.java
  27. +14 −13 ...keystone-cli/src/main/java/org/platformlayer/keystone/cli/autocomplete/UserNameAutoCompleter.java
  28. +13 −13 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/commands/CreateProject.java
  29. +13 −13 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/commands/CreateUser.java
  30. +20 −20 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/commands/JoinProject.java
  31. +6 −5 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/commands/KeystoneCommandRegistry.java
  32. +9 −8 ...keystone-cli/src/main/java/org/platformlayer/keystone/cli/commands/KeystoneCommandRunnerBase.java
  33. +18 −18 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/commands/ListProjects.java
  34. +11 −11 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/commands/ListUsers.java
  35. +4 −4 ...ystone-cli/src/main/java/org/platformlayer/keystone/cli/formatters/KeystoneFormatterRegistry.java
  36. +10 −10 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/formatters/OpsProjectFormatter.java
  37. +11 −11 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/formatters/OpsUserFormatter.java
  38. +36 −35 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/guice/CliModule.java
  39. +5 −4 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/model/ProjectName.java
  40. +5 −4 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/model/UserName.java
  41. +46 −46 auth/server-admin/src/main/java/org/openstack/keystone/resources/admin/TenantsResource.java
  42. +43 −40 auth/server-admin/src/main/java/org/openstack/keystone/resources/admin/TokensResource.java
  43. +18 −17 auth/server-admin/src/main/java/org/openstack/keystone/server/AdminServerConfig.java
  44. +24 −23 auth/server-admin/src/main/java/org/openstack/keystone/server/KeystoneAdminServer.java
  45. +43 −43 auth/server-admin/src/main/java/org/platformlayer/auth/FakeAuthServlet.java
  46. +30 −29 auth/server-admin/src/main/java/org/platformlayer/auth/StandaloneAuthServer.java
  47. +15 −15 auth/server-shared/src/main/java/org/openstack/keystone/jaxrs/JacksonConfigurator.java
  48. +2 −2 auth/server-shared/src/main/java/org/openstack/keystone/model/Access.java
  49. +7 −7 auth/server-shared/src/main/java/org/openstack/keystone/model/Auth.java
  50. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/model/AuthenticateRequest.java
  51. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/model/AuthenticateResponse.java
  52. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/model/Ec2ConvertTokenRequest.java
  53. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/model/Ec2ConvertTokenResponse.java
  54. +6 −6 auth/server-shared/src/main/java/org/openstack/keystone/model/Ec2Credentials.java
  55. +2 −2 auth/server-shared/src/main/java/org/openstack/keystone/model/PasswordCredentials.java
  56. +3 −3 auth/server-shared/src/main/java/org/openstack/keystone/model/Role.java
  57. +2 −2 auth/server-shared/src/main/java/org/openstack/keystone/model/RoleList.java
  58. +3 −3 auth/server-shared/src/main/java/org/openstack/keystone/model/Service.java
  59. +10 −9 auth/server-shared/src/main/java/org/openstack/keystone/model/ServiceEndpoint.java
  60. +6 −6 auth/server-shared/src/main/java/org/openstack/keystone/model/ServiceVersion.java
  61. +7 −7 auth/server-shared/src/main/java/org/openstack/keystone/model/Tenant.java
  62. +4 −4 auth/server-shared/src/main/java/org/openstack/keystone/model/TenantEndpoint.java
  63. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/model/TenantEndpointList.java
  64. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/model/TenantsList.java
  65. +3 −3 auth/server-shared/src/main/java/org/openstack/keystone/model/Token.java
  66. +7 −7 auth/server-shared/src/main/java/org/openstack/keystone/model/User.java
  67. +4 −4 auth/server-shared/src/main/java/org/openstack/keystone/model/UserValidation.java
  68. +2 −2 auth/server-shared/src/main/java/org/openstack/keystone/model/ValidateAccess.java
  69. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/model/ValidateTokenResponse.java
  70. +61 −59 auth/server-shared/src/main/java/org/openstack/keystone/resources/KeystoneResourceBase.java
  71. +31 −31 auth/server-shared/src/main/java/org/openstack/keystone/resources/Mapping.java
  72. +64 −62 auth/server-shared/src/main/java/org/openstack/keystone/server/GuiceAuthenticationConfig.java
  73. +108 −106 auth/server-shared/src/main/java/org/openstack/keystone/services/AuthenticationFacade.java
  74. +2 −2 auth/server-shared/src/main/java/org/openstack/keystone/services/CacheSystem.java
  75. +40 −40 auth/server-shared/src/main/java/org/openstack/keystone/services/GroupResolver.java
  76. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/services/GroupToTenantMapper.java
  77. +1 −1 auth/server-shared/src/main/java/org/openstack/keystone/services/ServiceDictionary.java
  78. +3 −3 auth/server-shared/src/main/java/org/openstack/keystone/services/TenantInfo.java
  79. +19 −19 auth/server-shared/src/main/java/org/openstack/keystone/services/TokenInfo.java
  80. +2 −2 auth/server-shared/src/main/java/org/openstack/keystone/services/TokenService.java
  81. +13 −13 auth/server-shared/src/main/java/org/openstack/keystone/services/UserInfo.java
  82. +155 −144 .../server-shared/src/main/java/org/openstack/keystone/services/crypto/SharedSecretTokenService.java
  83. +1 −0 auth/server-shared/src/main/java/org/openstack/keystone/services/ldap/LdapAuthentication.java
  84. +33 −30 auth/server-shared/src/main/java/org/openstack/keystone/services/ldap/LdapGroupToTenantMapper.java
  85. +42 −40 ...ver-shared/src/main/java/org/openstack/keystone/services/memory/PropertiesBasedAuthenticator.java
  86. +28 −28 ...r-shared/src/main/java/org/openstack/keystone/services/memory/PropertiesBasedGroupMembership.java
  87. +99 −99 auth/server-shared/src/main/java/org/openstack/keystone/services/memory/SimpleCacheSystem.java
  88. +30 −29 ...server-shared/src/main/java/org/openstack/keystone/services/memory/SimpleGroupToTenantMapper.java
  89. +100 −95 auth/server-shared/src/main/java/org/openstack/keystone/services/memory/SimpleServiceDictionary.java
  90. +43 −43 auth/server-shared/src/main/java/org/platformlayer/auth/FakeAuthServlet.java
  91. +36 −36 auth/server-user/src/main/java/org/openstack/keystone/resources/user/Ec2TokensResource.java
  92. +68 −68 auth/server-user/src/main/java/org/openstack/keystone/resources/user/TokensResource.java
  93. +25 −24 auth/server-user/src/main/java/org/openstack/keystone/server/KeystoneUserServer.java
  94. +29 −28 auth/server-user/src/main/java/org/openstack/keystone/server/ServiceMapper.java
  95. +12 −12 auth/server-user/src/main/java/org/openstack/keystone/server/UserServerConfig.java
  96. +32 −32 bindings/cli/src/main/java/org/platformlayer/client/cli/PlatformLayerCli.java
  97. +117 −116 bindings/cli/src/main/java/org/platformlayer/client/cli/PlatformLayerCliContext.java
  98. +20 −20 bindings/cli/src/main/java/org/platformlayer/client/cli/autocomplete/AutoCompleteItemPath.java
  99. +8 −8 bindings/cli/src/main/java/org/platformlayer/client/cli/autocomplete/AutoCompleteItemType.java
  100. +11 −11 bindings/cli/src/main/java/org/platformlayer/client/cli/autocomplete/AutoCompleteJobId.java
  101. +8 −8 bindings/cli/src/main/java/org/platformlayer/client/cli/autocomplete/AutoCompleteServiceType.java
  102. +13 −13 ...cli/src/main/java/org/platformlayer/client/cli/autocomplete/PlatformLayerSimpleAutoCompleter.java
  103. +12 −12 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/DeleteItem.java
  104. +27 −27 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/DeleteTag.java
  105. +19 −19 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/DoAction.java
  106. +42 −45 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/GetEndpoint.java
  107. +25 −25 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/GetItem.java
  108. +43 −42 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/GetJobLog.java
  109. +14 −14 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/GetMetric.java
  110. +18 −17 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/GetSshKey.java
  111. +47 −45 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/JythonToJson.java
  112. +20 −20 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/ListChildren.java
  113. +24 −24 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/ListItems.java
  114. +35 −35 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/ListJobs.java
  115. +12 −12 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/ListMetrics.java
  116. +17 −17 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/ListRoots.java
  117. +17 −17 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/ListServices.java
  118. +12 −12 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/ListTags.java
  119. +0 −1 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/OpenItem.java
  120. +4 −4 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/PlatformLayerCommandRegistry.java
  121. +44 −41 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/PlatformLayerCommandRunnerBase.java
  122. +21 −21 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/PutItem.java
  123. +137 −136 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/ScriptCommands.java
  124. +0 −1 bindings/cli/src/main/java/org/platformlayer/client/cli/commands/SshItem.java
  125. +3 −3 bindings/cli/src/main/java/org/platformlayer/client/cli/model/ConfigureAction.java
  126. +6 −6 bindings/cli/src/main/java/org/platformlayer/client/cli/model/ItemPath.java
  127. +14 −14 bindings/cli/src/main/java/org/platformlayer/client/cli/output/JobDataFormatter.java
  128. +14 −14 bindings/cli/src/main/java/org/platformlayer/client/cli/output/JobLogLineFormatter.java
  129. +12 −12 bindings/cli/src/main/java/org/platformlayer/client/cli/output/MetricInfoFormatter.java
  130. +12 −12 bindings/cli/src/main/java/org/platformlayer/client/cli/output/MetricValueFormatter.java
  131. +10 −10 bindings/cli/src/main/java/org/platformlayer/client/cli/output/PlatformLayerFormatterRegistry.java
  132. +15 −15 bindings/cli/src/main/java/org/platformlayer/client/cli/output/ServiceInfoFormatter.java
  133. +12 −12 bindings/cli/src/main/java/org/platformlayer/client/cli/output/TagFormatter.java
  134. +12 −12 bindings/cli/src/main/java/org/platformlayer/client/cli/output/TextFormatRows.java
  135. +109 −109 bindings/cli/src/main/java/org/platformlayer/client/cli/output/UntypedItemFormatter.java
  136. +1 −1 bindings/platformlayer-api/src/main/java/org/platformlayer/CheckedFunction.java
  137. +368 −342 bindings/platformlayer-api/src/main/java/org/platformlayer/DirectPlatformLayerClient.java
  138. +1 −1 bindings/platformlayer-api/src/main/java/org/platformlayer/Format.java
  139. +7 −7 bindings/platformlayer-api/src/main/java/org/platformlayer/PlatformLayerAuthenticationException.java
  140. +45 −43 bindings/platformlayer-api/src/main/java/org/platformlayer/PlatformLayerClient.java
  141. +46 −46 bindings/platformlayer-api/src/main/java/org/platformlayer/PlatformLayerClientException.java
  142. +98 −94 bindings/platformlayer-api/src/main/java/org/platformlayer/PlatformLayerHttpClient.java
  143. +215 −211 bindings/platformlayer-api/src/main/java/org/platformlayer/PlatformLayerHttpRequest.java
  144. +16 −14 bindings/platformlayer-api/src/main/java/org/platformlayer/PlatformLayerUtils.java
  145. +13 −12 bindings/platformlayer-api/src/main/java/org/platformlayer/ServiceUtils.java
  146. +21 −21 bindings/platformlayer-api/src/main/java/org/platformlayer/TypedItemMapper.java
  147. +166 −163 bindings/platformlayer-api/src/main/java/org/platformlayer/UntypedItem.java
  148. +45 −45 bindings/platformlayer-api/src/main/java/org/platformlayer/UntypedItemCollection.java
  149. +8 −8 bindings/platformlayer-api/src/main/java/org/platformlayer/UrlUtils.java
  150. +34 −34 bindings/platformlayer-api/src/main/java/org/platformlayer/auth/AuthenticationSignature.java
  151. +37 −37 bindings/platformlayer-api/src/main/java/org/platformlayer/auth/DirectAuthenticationToken.java
  152. +16 −16 bindings/platformlayer-api/src/main/java/org/platformlayer/auth/DirectAuthenticator.java
  153. +610 −593 ...gs/platformlayer-api/src/main/java/org/platformlayer/federation/FederatedPlatformLayerClient.java
  154. +197 −195 bindings/platformlayer-api/src/main/java/org/platformlayer/federation/FederationMap.java
  155. +47 −40 bindings/platformlayer-api/src/main/java/org/platformlayer/federation/FederationMapping.java
  156. +50 −49 bindings/platformlayer-api/src/main/java/org/platformlayer/federation/SmartDeserialization.java
  157. +4 −4 ...s/platformlayer-api/src/main/java/org/platformlayer/federation/model/FederationConfiguration.java
  158. +2 −2 bindings/platformlayer-api/src/main/java/org/platformlayer/federation/model/FederationRule.java
  159. +5 −5 ...er-api/src/main/java/org/platformlayer/federation/model/PlatformLayerConnectionConfiguration.java
  160. +40 −40 bindings/platformlayer-api/src/main/java/org/platformlayer/forkjoin/FakeForkJoinStrategy.java
  161. +1 −1 bindings/platformlayer-api/src/main/java/org/platformlayer/forkjoin/ForkJoinStrategy.java
  162. +5 −4 bindings/platformlayer-api/src/main/java/org/platformlayer/forkjoin/ListConcatentation.java
  163. +39 −38 bindings/platformlayer-api/src/main/java/org/platformlayer/forkjoin/ToIterable.java
  164. +2 −3 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/commons/Accessor.java
  165. +2 −2 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/commons/BasicInjector.java
  166. +11 −11 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/commons/HttpRequestTransport.java
  167. +4 −4 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/commons/Injection.java
  168. +16 −15 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/commons/TextColumn.java
  169. +36 −36 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/events/EditItemEvent.java
  170. +18 −18 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/model/DomainModel.java
  171. +1 −0 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/model/EditItemActivity.java
  172. +153 −148 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/model/ItemEditorWorkflow.java
  173. +179 −178 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/client/model/ItemGrid.java
  174. +22 −22 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/server/GwtServiceBase.java
  175. +6 −5 ...shared/src/main/java/org/platformlayer/ui/shared/server/inject/InjectedRequestFactoryServlet.java
  176. +10 −10 ...hared/src/main/java/org/platformlayer/ui/shared/server/inject/InjectingServiceLayerDecorator.java
  177. +6 −6 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/server/inject/InjectingServiceLocator.java
  178. +42 −42 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/server/inject/PlatformLayerLiveObjects.java
  179. +282 −282 ...d/src/main/java/org/platformlayer/ui/shared/server/inject/PlatformLayerServiceLayerDecorator.java
  180. +15 −15 ...-shared/src/main/java/org/platformlayer/ui/shared/server/inject/ServiceLayerDecoratorFactory.java
  181. +3 −3 gui/gwt-shared/src/main/java/org/platformlayer/ui/shared/shared/BaseEntityRequest.java
  182. +81 −78 ops/core/src/main/java/org/platformlayer/ops/BindingScope.java
  183. +94 −92 ops/core/src/main/java/org/platformlayer/ops/ChrootOpsTarget.java
  184. +15 −15 ops/core/src/main/java/org/platformlayer/ops/CloudContext.java
  185. +11 −11 ops/core/src/main/java/org/platformlayer/ops/CloudContextProvider.java
  186. +36 −36 ops/core/src/main/java/org/platformlayer/ops/CloudContextRegistry.java
  187. +1 −1 ops/core/src/main/java/org/platformlayer/ops/CloudImage.java
  188. +15 −15 ops/core/src/main/java/org/platformlayer/ops/CommandEnvironment.java
  189. +19 −19 ops/core/src/main/java/org/platformlayer/ops/CreationValidator.java
  190. +1 −1 ops/core/src/main/java/org/platformlayer/ops/CustomRecursor.java
  191. +38 −32 ops/core/src/main/java/org/platformlayer/ops/EnumUtils.java
  192. +1 −1 ops/core/src/main/java/org/platformlayer/ops/Handler.java
  193. +3 −3 ops/core/src/main/java/org/platformlayer/ops/Injection.java
  194. +14 −14 ops/core/src/main/java/org/platformlayer/ops/Machine.java
  195. +18 −18 ops/core/src/main/java/org/platformlayer/ops/MachineBase.java
  196. +9 −9 ops/core/src/main/java/org/platformlayer/ops/MachineCreationRequest.java
  197. +68 −68 ops/core/src/main/java/org/platformlayer/ops/MetricCollector.java
  198. +129 −124 ops/core/src/main/java/org/platformlayer/ops/MetricFetcher.java
  199. +32 −32 ops/core/src/main/java/org/platformlayer/ops/OpaqueMachine.java
  200. +16 −16 ops/core/src/main/java/org/platformlayer/ops/OperationRecursor.java
  201. +36 −36 ops/core/src/main/java/org/platformlayer/ops/OperationType.java
  202. +39 −39 ops/core/src/main/java/org/platformlayer/ops/OpsConfig.java
  203. +13 −14 ops/core/src/main/java/org/platformlayer/ops/OpsConfigException.java
  204. +29 −30 ops/core/src/main/java/org/platformlayer/ops/OpsConfiguration.java
  205. +30 −32 ops/core/src/main/java/org/platformlayer/ops/OpsProvider.java
  206. +3 −4 ops/core/src/main/java/org/platformlayer/ops/OpsServiceNotAuthorizedException.java
  207. +21 −20 ops/core/src/main/java/org/platformlayer/ops/OpsTarget.java
  208. +294 −280 ops/core/src/main/java/org/platformlayer/ops/OpsTargetBase.java
  209. +1 −1 ops/core/src/main/java/org/platformlayer/ops/OpsTree.java
  210. +70 −67 ops/core/src/main/java/org/platformlayer/ops/ServiceConfiguration.java
  211. +28 −28 ops/core/src/main/java/org/platformlayer/ops/ServiceInitializer.java
  212. +242 −236 ops/core/src/main/java/org/platformlayer/ops/ServiceProviderBase.java
  213. +75 −74 ops/core/src/main/java/org/platformlayer/ops/SshOpsTarget.java
  214. +43 −42 ops/core/src/main/java/org/platformlayer/ops/UniqueTag.java
  215. +132 −131 ops/core/src/main/java/org/platformlayer/ops/UserInfo.java
  216. +103 −103 ops/core/src/main/java/org/platformlayer/ops/backups/BackupContext.java
  217. +3 −3 ops/core/src/main/java/org/platformlayer/ops/backups/BackupData.java
  218. +27 −27 ops/core/src/main/java/org/platformlayer/ops/backups/BackupDirectory.java
  219. +10 −10 ops/core/src/main/java/org/platformlayer/ops/backups/BackupItem.java
  220. +108 −108 ops/core/src/main/java/org/platformlayer/ops/backups/RemoteCurlOpenstackSession.java
  221. +92 −88 ops/core/src/main/java/org/platformlayer/ops/backups/ShellBackupClient.java
  222. +8 −8 ops/core/src/main/java/org/platformlayer/ops/crypto/FilenameEndsWithFilter.java
  223. +5 −5 ops/core/src/main/java/org/platformlayer/ops/crypto/OpsKeyStore.java
  224. +17 −17 ops/core/src/main/java/org/platformlayer/ops/crypto/Passwords.java
  225. +119 −118 ops/core/src/main/java/org/platformlayer/ops/crypto/SecretHelper.java
  226. +59 −58 ops/core/src/main/java/org/platformlayer/ops/crypto/SimpleOpsKeyStore.java
  227. +8 −7 ops/core/src/main/java/org/platformlayer/ops/dns/DnsResolver.java
  228. +32 −32 ops/core/src/main/java/org/platformlayer/ops/dns/DnsResolverModuleBuilder.java
  229. +44 −44 ops/core/src/main/java/org/platformlayer/ops/endpoints/EndpointDnsRecord.java
  230. +27 −27 ops/core/src/main/java/org/platformlayer/ops/endpoints/EndpointHelpers.java
  231. +11 −9 ops/core/src/main/java/org/platformlayer/ops/endpoints/EndpointInfo.java
  232. +5 −10 ops/core/src/main/java/org/platformlayer/ops/filesystem/ExpandArchive.java
  233. +166 −165 ops/core/src/main/java/org/platformlayer/ops/filesystem/FilesystemInfo.java
  234. +45 −45 ops/core/src/main/java/org/platformlayer/ops/filesystem/ManagedDirectory.java
  235. +263 −263 ops/core/src/main/java/org/platformlayer/ops/filesystem/ManagedFile.java
Sorry, we could not display the entire diff because too many files (723) changed.
View
2 auth/client/src/main/java/org/openstack/keystone/auth/client/Keystone.java
@@ -1,5 +1,5 @@
package org.openstack.keystone.auth.client;
public class Keystone {
- public static final String AUTH_HEADER = "X-Auth-Token";
+ public static final String AUTH_HEADER = "X-Auth-Token";
}
View
197 ...client/src/main/java/org/openstack/keystone/auth/client/KeystoneAuthenticationClient.java
@@ -25,102 +25,105 @@
import org.slf4j.LoggerFactory;
public class KeystoneAuthenticationClient {
- static final Logger log = LoggerFactory.getLogger(KeystoneAuthenticationClient.class);
-
- final String authenticationUrl;
-
- public static final String DEFAULT_AUTHENTICATION_URL = "http://127.0.0.1:" + WellKnownPorts.PORT_PLATFORMLAYER_AUTH_USER + "/v2.0/";
-
- public static final Integer HTTP_500_ERROR = new Integer(500);
-
- protected static final int MAX_RETRIES = 10;
-
- static Random random = new Random();
-
- public KeystoneAuthenticationClient(String authenticationUrl) {
- this.authenticationUrl = authenticationUrl;
- }
-
- public KeystoneAuthenticationClient() {
- this(DEFAULT_AUTHENTICATION_URL);
- }
-
- public TenantsList listTenants(KeystoneAuthenticationToken token) throws KeystoneAuthenticationException {
- return doSimpleRequest(token, "GET", "tokens", null, TenantsList.class);
- }
-
- public KeystoneAuthenticationToken authenticate(String tenantName, PasswordCredentials passwordCredentials) throws KeystoneAuthenticationException {
- Auth auth = new Auth();
- auth.setPasswordCredentials(passwordCredentials);
- auth.setTenantName(tenantName);
-
- AuthenticateRequest request = new AuthenticateRequest();
- request.setAuth(auth);
-
- AuthenticateResponse response = doSimpleRequest(null, "POST", "tokens", request, AuthenticateResponse.class);
- return new KeystoneAuthenticationToken(response.getAccess());
- }
-
- private <T> T doSimpleRequest(KeystoneAuthenticationToken token, String method, String relativeUri, Object postObject, Class<T> responseClass) throws KeystoneAuthenticationException {
- try {
- URI uri = new URI(authenticationUrl + relativeUri);
-
- SimpleHttpRequest httpRequest = SimpleHttpRequest.build(method, uri);
-
- httpRequest.setRequestHeader("Accept", "application/xml");
-
- if (token != null) {
- token.populateRequest(httpRequest);
- }
-
- if (postObject != null) {
- httpRequest.setRequestHeader("Content-Type", "application/xml");
- String xml = serializeXml(postObject);
- httpRequest.getOutputStream().write(Utf8.getBytes(xml));
- }
-
- SimpleHttpResponse response = httpRequest.doRequest();
-
- int responseCode = response.getHttpResponseCode();
- switch (responseCode) {
- case 401:
- throw new KeystoneAuthenticationException("Platformlayer credentials were not correct");
-
- case 200:
- case 203: {
- if (responseClass.equals(String.class)) {
- return CastUtils.as(IoUtils.readAll(response.getInputStream()), responseClass);
- } else {
- return deserializeXml(response.getInputStream(), responseClass);
- }
- }
-
- default:
- throw new KeystoneAuthenticationException("Unexpected result code: " + responseCode);
- }
- } catch (IOException e) {
- throw new KeystoneAuthenticationException("Error communicating with authentication service", e);
- } catch (URISyntaxException e) {
- throw new KeystoneAuthenticationException("Error building authentication URI", e);
- }
-
- }
-
- public static <T> T deserializeXml(InputStream is, Class<T> clazz) throws KeystoneAuthenticationException {
- try {
- return JaxbHelper.deserializeXmlObject(is, clazz, true);
- } catch (UnmarshalException e) {
- throw new KeystoneAuthenticationException("Error reading authentication response data", e);
- }
- }
-
- public static String serializeXml(Object object) throws KeystoneAuthenticationException {
- try {
- boolean formatted = false;
- return JaxbHelper.toXml(object, formatted);
- } catch (JAXBException e) {
- throw new KeystoneAuthenticationException("Error serializing data", e);
- }
- }
+ static final Logger log = LoggerFactory.getLogger(KeystoneAuthenticationClient.class);
+
+ final String authenticationUrl;
+
+ public static final String DEFAULT_AUTHENTICATION_URL = "http://127.0.0.1:"
+ + WellKnownPorts.PORT_PLATFORMLAYER_AUTH_USER + "/v2.0/";
+
+ public static final Integer HTTP_500_ERROR = new Integer(500);
+
+ protected static final int MAX_RETRIES = 10;
+
+ static Random random = new Random();
+
+ public KeystoneAuthenticationClient(String authenticationUrl) {
+ this.authenticationUrl = authenticationUrl;
+ }
+
+ public KeystoneAuthenticationClient() {
+ this(DEFAULT_AUTHENTICATION_URL);
+ }
+
+ public TenantsList listTenants(KeystoneAuthenticationToken token) throws KeystoneAuthenticationException {
+ return doSimpleRequest(token, "GET", "tokens", null, TenantsList.class);
+ }
+
+ public KeystoneAuthenticationToken authenticate(String tenantName, PasswordCredentials passwordCredentials)
+ throws KeystoneAuthenticationException {
+ Auth auth = new Auth();
+ auth.setPasswordCredentials(passwordCredentials);
+ auth.setTenantName(tenantName);
+
+ AuthenticateRequest request = new AuthenticateRequest();
+ request.setAuth(auth);
+
+ AuthenticateResponse response = doSimpleRequest(null, "POST", "tokens", request, AuthenticateResponse.class);
+ return new KeystoneAuthenticationToken(response.getAccess());
+ }
+
+ private <T> T doSimpleRequest(KeystoneAuthenticationToken token, String method, String relativeUri,
+ Object postObject, Class<T> responseClass) throws KeystoneAuthenticationException {
+ try {
+ URI uri = new URI(authenticationUrl + relativeUri);
+
+ SimpleHttpRequest httpRequest = SimpleHttpRequest.build(method, uri);
+
+ httpRequest.setRequestHeader("Accept", "application/xml");
+
+ if (token != null) {
+ token.populateRequest(httpRequest);
+ }
+
+ if (postObject != null) {
+ httpRequest.setRequestHeader("Content-Type", "application/xml");
+ String xml = serializeXml(postObject);
+ httpRequest.getOutputStream().write(Utf8.getBytes(xml));
+ }
+
+ SimpleHttpResponse response = httpRequest.doRequest();
+
+ int responseCode = response.getHttpResponseCode();
+ switch (responseCode) {
+ case 401:
+ throw new KeystoneAuthenticationException("Platformlayer credentials were not correct");
+
+ case 200:
+ case 203: {
+ if (responseClass.equals(String.class)) {
+ return CastUtils.as(IoUtils.readAll(response.getInputStream()), responseClass);
+ } else {
+ return deserializeXml(response.getInputStream(), responseClass);
+ }
+ }
+
+ default:
+ throw new KeystoneAuthenticationException("Unexpected result code: " + responseCode);
+ }
+ } catch (IOException e) {
+ throw new KeystoneAuthenticationException("Error communicating with authentication service", e);
+ } catch (URISyntaxException e) {
+ throw new KeystoneAuthenticationException("Error building authentication URI", e);
+ }
+
+ }
+
+ public static <T> T deserializeXml(InputStream is, Class<T> clazz) throws KeystoneAuthenticationException {
+ try {
+ return JaxbHelper.deserializeXmlObject(is, clazz, true);
+ } catch (UnmarshalException e) {
+ throw new KeystoneAuthenticationException("Error reading authentication response data", e);
+ }
+ }
+
+ public static String serializeXml(Object object) throws KeystoneAuthenticationException {
+ try {
+ boolean formatted = false;
+ return JaxbHelper.toXml(object, formatted);
+ } catch (JAXBException e) {
+ throw new KeystoneAuthenticationException("Error serializing data", e);
+ }
+ }
}
View
14 ...ent/src/main/java/org/openstack/keystone/auth/client/KeystoneAuthenticationException.java
@@ -3,13 +3,13 @@
import org.platformlayer.auth.OpenstackAuthenticationException;
public class KeystoneAuthenticationException extends OpenstackAuthenticationException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public KeystoneAuthenticationException(String message) {
- super(message);
- }
+ public KeystoneAuthenticationException(String message) {
+ super(message);
+ }
- public KeystoneAuthenticationException(String message, Exception e) {
- super(message, e);
- }
+ public KeystoneAuthenticationException(String message, Exception e) {
+ super(message, e);
+ }
}
View
66 .../client/src/main/java/org/openstack/keystone/auth/client/KeystoneAuthenticationToken.java
@@ -9,37 +9,39 @@
import com.google.common.base.Objects;
public class KeystoneAuthenticationToken implements AuthenticationToken {
- private final Access access;
-
- public KeystoneAuthenticationToken(Access access) {
- this.access = access;
- }
-
- public String getAuthTokenValue() {
- return access.getToken().getId();
- }
-
- @Override
- public String getServiceUrl(String serviceKey) {
- for (Service service : access.getServiceCatalog()) {
- if (Objects.equal(service.getType(), serviceKey)) {
- String bestUrl = null;
- for (ServiceEndpoint endpoint : service.getEndpoints()) {
- bestUrl = endpoint.getPublicURL();
- if (bestUrl != null)
- break;
- }
-
- if (bestUrl != null)
- return bestUrl;
- }
- }
- return null;
- }
-
- @Override
- public void populateRequest(SimpleHttpRequest httpRequest) {
- httpRequest.setRequestHeader("X-Auth-Token", getAuthTokenValue());
- }
+ private final Access access;
+
+ public KeystoneAuthenticationToken(Access access) {
+ this.access = access;
+ }
+
+ public String getAuthTokenValue() {
+ return access.getToken().getId();
+ }
+
+ @Override
+ public String getServiceUrl(String serviceKey) {
+ for (Service service : access.getServiceCatalog()) {
+ if (Objects.equal(service.getType(), serviceKey)) {
+ String bestUrl = null;
+ for (ServiceEndpoint endpoint : service.getEndpoints()) {
+ bestUrl = endpoint.getPublicURL();
+ if (bestUrl != null) {
+ break;
+ }
+ }
+
+ if (bestUrl != null) {
+ return bestUrl;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void populateRequest(SimpleHttpRequest httpRequest) {
+ httpRequest.setRequestHeader("X-Auth-Token", getAuthTokenValue());
+ }
}
View
88 auth/client/src/main/java/org/openstack/keystone/auth/client/KeystoneAuthenticator.java
@@ -8,49 +8,49 @@
import org.platformlayer.auth.Authenticator;
public class KeystoneAuthenticator implements Authenticator {
- final String tenantId;
-
- final String username;
- final String password;
-
- final KeystoneAuthenticationClient client;
-
- AuthenticationToken token = null;
-
- public KeystoneAuthenticator(String tenantId, String username, String password, String server) {
- this.tenantId = tenantId;
- this.username = username;
- this.password = password;
- String authenticationUrl = server != null ? server : KeystoneAuthenticationClient.DEFAULT_AUTHENTICATION_URL;
-
- this.client = new KeystoneAuthenticationClient(authenticationUrl);
- }
-
- @Override
- public AuthenticationToken getAuthenticationToken() throws KeystoneAuthenticationException {
- if (token == null) {
- PasswordCredentials passwordCredentials = new PasswordCredentials();
- passwordCredentials.setUsername(username);
- passwordCredentials.setPassword(password);
-
- token = client.authenticate(tenantId, passwordCredentials);
- }
- return token;
- }
-
- @Override
- public void clearAuthenticationToken() {
- token = null;
- }
-
- @Override
- public String getHost() {
- try {
- URL url = new URL(client.authenticationUrl);
- return url.getHost();
- } catch (MalformedURLException e) {
- throw new IllegalStateException("Error parsing URL", e);
- }
- }
+ final String tenantId;
+
+ final String username;
+ final String password;
+
+ final KeystoneAuthenticationClient client;
+
+ AuthenticationToken token = null;
+
+ public KeystoneAuthenticator(String tenantId, String username, String password, String server) {
+ this.tenantId = tenantId;
+ this.username = username;
+ this.password = password;
+ String authenticationUrl = server != null ? server : KeystoneAuthenticationClient.DEFAULT_AUTHENTICATION_URL;
+
+ this.client = new KeystoneAuthenticationClient(authenticationUrl);
+ }
+
+ @Override
+ public AuthenticationToken getAuthenticationToken() throws KeystoneAuthenticationException {
+ if (token == null) {
+ PasswordCredentials passwordCredentials = new PasswordCredentials();
+ passwordCredentials.setUsername(username);
+ passwordCredentials.setPassword(password);
+
+ token = client.authenticate(tenantId, passwordCredentials);
+ }
+ return token;
+ }
+
+ @Override
+ public void clearAuthenticationToken() {
+ token = null;
+ }
+
+ @Override
+ public String getHost() {
+ try {
+ URL url = new URL(client.authenticationUrl);
+ return url.getHost();
+ } catch (MalformedURLException e) {
+ throw new IllegalStateException("Error parsing URL", e);
+ }
+ }
}
View
6 auth/client/src/main/java/org/openstack/keystone/service/AccountId.java
@@ -3,8 +3,8 @@
import org.platformlayer.model.StringWrapper;
public class AccountId extends StringWrapper {
- public AccountId(String id) {
- super(id);
- }
+ public AccountId(String id) {
+ super(id);
+ }
}
View
2 auth/client/src/main/java/org/openstack/keystone/service/AuthenticationTokenValidator.java
@@ -3,5 +3,5 @@
import org.platformlayer.model.Authentication;
public interface AuthenticationTokenValidator {
- Authentication validate(String authToken);
+ Authentication validate(String authToken);
}
View
87 auth/client/src/main/java/org/openstack/keystone/service/DevelopmentTokenValidator.java
@@ -9,62 +9,63 @@
import org.slf4j.LoggerFactory;
public class DevelopmentTokenValidator implements AuthenticationTokenValidator {
- static final Logger log = LoggerFactory.getLogger(DevelopmentTokenValidator.class);
+ static final Logger log = LoggerFactory.getLogger(DevelopmentTokenValidator.class);
- @Inject
- KeystoneTokenValidator keystone;
+ @Inject
+ KeystoneTokenValidator keystone;
- public DevelopmentTokenValidator() {
- if (!ApplicationMode.isDevelopment())
- throw new IllegalStateException();
- }
+ public DevelopmentTokenValidator() {
+ if (!ApplicationMode.isDevelopment()) {
+ throw new IllegalStateException();
+ }
+ }
- public static final String PREFIX = "DEV-TOKEN-";
+ public static final String PREFIX = "DEV-TOKEN-";
- class DevelopmentAuthentication implements Authentication {
+ class DevelopmentAuthentication implements Authentication {
- final String project;
- final String userKey;
+ final String project;
+ final String userKey;
- public DevelopmentAuthentication(String userKey, String project) {
- super();
- this.userKey = userKey;
- this.project = project;
- }
+ public DevelopmentAuthentication(String userKey, String project) {
+ super();
+ this.userKey = userKey;
+ this.project = project;
+ }
- @Override
- public String getProject() {
- return project;
- }
+ @Override
+ public String getProject() {
+ return project;
+ }
- @Override
- public boolean isInRole(String project, RoleId role) {
- return true;
- }
+ @Override
+ public boolean isInRole(String project, RoleId role) {
+ return true;
+ }
- @Override
- public byte[] getUserSecret() {
- return null;
- }
+ @Override
+ public byte[] getUserSecret() {
+ return null;
+ }
- @Override
- public String getUserKey() {
- return userKey;
- }
+ @Override
+ public String getUserKey() {
+ return userKey;
+ }
- }
+ }
- @Override
- public Authentication validate(String authToken) {
- authToken = authToken.trim();
+ @Override
+ public Authentication validate(String authToken) {
+ authToken = authToken.trim();
- if (authToken.startsWith(PREFIX)) {
- String project = authToken.substring(PREFIX.length());
- String userKey = project;
+ if (authToken.startsWith(PREFIX)) {
+ String project = authToken.substring(PREFIX.length());
+ String userKey = project;
- return new DevelopmentAuthentication(userKey, project);
- }
+ return new DevelopmentAuthentication(userKey, project);
+ }
- return keystone.validate(authToken);
- }
+ return keystone.validate(authToken);
+ }
}
View
68 auth/client/src/main/java/org/openstack/keystone/service/KeystoneAuthentication.java
@@ -6,38 +6,38 @@
import org.platformlayer.model.RoleId;
public class KeystoneAuthentication implements Authentication {
- private final String userKey;
- private final String tenantKey;
- private final List<String> roles;
- private final byte[] userSecret;
-
- public KeystoneAuthentication(String userKey, String tenantKey, byte[] userSecret, List<String> roles) {
- this.userKey = userKey;
- this.tenantKey = tenantKey;
- this.userSecret = userSecret;
- this.roles = roles;
- }
-
- @Override
- public String getProject() {
- return tenantKey;
- }
-
- @Override
- public boolean isInRole(String project, RoleId role) {
- if (project.equals(tenantKey)) {
- return roles.contains(role.getKey());
- }
- return false;
- }
-
- @Override
- public byte[] getUserSecret() {
- return userSecret;
- }
-
- @Override
- public String getUserKey() {
- return userKey;
- }
+ private final String userKey;
+ private final String tenantKey;
+ private final List<String> roles;
+ private final byte[] userSecret;
+
+ public KeystoneAuthentication(String userKey, String tenantKey, byte[] userSecret, List<String> roles) {
+ this.userKey = userKey;
+ this.tenantKey = tenantKey;
+ this.userSecret = userSecret;
+ this.roles = roles;
+ }
+
+ @Override
+ public String getProject() {
+ return tenantKey;
+ }
+
+ @Override
+ public boolean isInRole(String project, RoleId role) {
+ if (project.equals(tenantKey)) {
+ return roles.contains(role.getKey());
+ }
+ return false;
+ }
+
+ @Override
+ public byte[] getUserSecret() {
+ return userSecret;
+ }
+
+ @Override
+ public String getUserKey() {
+ return userKey;
+ }
}
View
140 auth/client/src/main/java/org/openstack/keystone/service/KeystoneTokenValidator.java
@@ -18,73 +18,75 @@
import com.google.common.collect.Lists;
public class KeystoneTokenValidator extends RestfulClient implements AuthenticationTokenValidator {
- static final Logger log = LoggerFactory.getLogger(KeystoneTokenValidator.class);
-
- public static final String DEFAULT_AUTHENTICATION_URL = "http://127.0.0.1:" + WellKnownPorts.PORT_PLATFORMLAYER_AUTH_ADMIN + "/";
-
- final String authenticationToken;
-
- public KeystoneTokenValidator(String baseUrl, String authenticationToken) {
- super(baseUrl);
- this.authenticationToken = authenticationToken;
- }
-
- @Override
- protected void addHeaders(SimpleHttpRequest httpRequest) {
- httpRequest.setRequestHeader(Keystone.AUTH_HEADER, authenticationToken);
- }
-
- // public KeystoneAuthenticationToken authenticate(String tenantName, PasswordCredentials passwordCredentials)
- // throws KeystoneAuthenticationException {
- // Auth auth = new Auth();
- // auth.setPasswordCredentials(passwordCredentials);
- // auth.setTenantName(tenantName);
- //
- // AuthenticateRequest request = new AuthenticateRequest();
- // request.setAuth(auth);
- //
- // AuthenticateResponse response = doSimpleRequest("POST", "tokens", request, AuthenticateResponse.class);
- // return new KeystoneAuthenticationToken(response.getAccess());
- // }
-
- @Override
- public Authentication validate(String authToken) {
- // v2.0/tokens/{userToken}[?belongsTo={tenant}]
-
- authToken = authToken.trim();
-
- String url = "v2.0/tokens/" + authToken;
-
- try {
- ValidateTokenResponse response = doSimpleRequest("GET", url, null, ValidateTokenResponse.class);
-
- ValidateAccess access = response.getAccess();
-
- Tenant tenant = access.getToken().getTenant();
- String tenantId = tenant.getId();
- if (tenantId == null)
- return null;
-
- List<String> roles = Lists.newArrayList();
- UserValidation userInfo = access.getUser();
- for (Role role : userInfo.getRoles()) {
- if (!role.getTenantId().equals(tenantId)) {
- throw new IllegalStateException("Tenant mismatch: " + role.getTenantId() + " vs " + tenantId);
- }
- roles.add(role.getName());
- }
-
- byte[] userSecret = userInfo.getSecret();
- String userKey = userInfo.getName();
-
- KeystoneAuthentication auth = new KeystoneAuthentication(userKey, tenantId, userSecret, roles);
- return auth;
- } catch (PlatformLayerClientException e) {
- if (e.getHttpResponseCode() != null && e.getHttpResponseCode() == 404) {
- // Not found => invalid token
- return null;
- }
- throw new IllegalArgumentException("Error while validating token", e);
- }
- }
+ static final Logger log = LoggerFactory.getLogger(KeystoneTokenValidator.class);
+
+ public static final String DEFAULT_AUTHENTICATION_URL = "http://127.0.0.1:"
+ + WellKnownPorts.PORT_PLATFORMLAYER_AUTH_ADMIN + "/";
+
+ final String authenticationToken;
+
+ public KeystoneTokenValidator(String baseUrl, String authenticationToken) {
+ super(baseUrl);
+ this.authenticationToken = authenticationToken;
+ }
+
+ @Override
+ protected void addHeaders(SimpleHttpRequest httpRequest) {
+ httpRequest.setRequestHeader(Keystone.AUTH_HEADER, authenticationToken);
+ }
+
+ // public KeystoneAuthenticationToken authenticate(String tenantName, PasswordCredentials passwordCredentials)
+ // throws KeystoneAuthenticationException {
+ // Auth auth = new Auth();
+ // auth.setPasswordCredentials(passwordCredentials);
+ // auth.setTenantName(tenantName);
+ //
+ // AuthenticateRequest request = new AuthenticateRequest();
+ // request.setAuth(auth);
+ //
+ // AuthenticateResponse response = doSimpleRequest("POST", "tokens", request, AuthenticateResponse.class);
+ // return new KeystoneAuthenticationToken(response.getAccess());
+ // }
+
+ @Override
+ public Authentication validate(String authToken) {
+ // v2.0/tokens/{userToken}[?belongsTo={tenant}]
+
+ authToken = authToken.trim();
+
+ String url = "v2.0/tokens/" + authToken;
+
+ try {
+ ValidateTokenResponse response = doSimpleRequest("GET", url, null, ValidateTokenResponse.class);
+
+ ValidateAccess access = response.getAccess();
+
+ Tenant tenant = access.getToken().getTenant();
+ String tenantId = tenant.getId();
+ if (tenantId == null) {
+ return null;
+ }
+
+ List<String> roles = Lists.newArrayList();
+ UserValidation userInfo = access.getUser();
+ for (Role role : userInfo.getRoles()) {
+ if (!role.getTenantId().equals(tenantId)) {
+ throw new IllegalStateException("Tenant mismatch: " + role.getTenantId() + " vs " + tenantId);
+ }
+ roles.add(role.getName());
+ }
+
+ byte[] userSecret = userInfo.getSecret();
+ String userKey = userInfo.getName();
+
+ KeystoneAuthentication auth = new KeystoneAuthentication(userKey, tenantId, userSecret, roles);
+ return auth;
+ } catch (PlatformLayerClientException e) {
+ if (e.getHttpResponseCode() != null && e.getHttpResponseCode() == 404) {
+ // Not found => invalid token
+ return null;
+ }
+ throw new IllegalArgumentException("Error while validating token", e);
+ }
+ }
}
View
145 ...lient/src/main/java/org/openstack/keystone/service/OpenstackAuthenticationFilterBase.java
@@ -16,77 +16,78 @@
import org.platformlayer.model.Authentication;
public abstract class OpenstackAuthenticationFilterBase implements Filter {
- static final Logger log = Logger.getLogger(OpenstackAuthenticationFilterBase.class);
-
- private final AuthenticationTokenValidator authenticationTokenValidator;
-
- protected OpenstackAuthenticationFilterBase(AuthenticationTokenValidator authenticationTokenValidator) {
- this.authenticationTokenValidator = authenticationTokenValidator;
- }
-
- @Override
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
- Scope authenticatedScope = Scope.inherit();
-
- // Fail safe
- authenticatedScope.put(Authentication.class, null);
-
- if (servletRequest instanceof HttpServletRequest) {
- HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
- HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
-
- try {
- Authentication authenticated = attemptAuthentication(httpServletRequest);
-
- if (authenticated == null) {
- httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
- return;
- } else {
- populateScope(authenticatedScope, authenticated);
- }
- } catch (SecurityException e) {
- httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
- return;
- } catch (Exception e) {
- // If we're down, don't tell the user that their password is wrong
- log.warn("Unexpected error in authentication filter", e);
- httpServletResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
- }
-
- authenticatedScope.push();
- try {
- filterChain.doFilter(servletRequest, servletResponse);
- } finally {
- authenticatedScope.pop();
- }
- }
-
- protected Authentication attemptAuthentication(HttpServletRequest httpServletRequest) throws Exception {
- String authToken = httpServletRequest.getHeader("X-Auth-Token");
-
- Authentication authenticated = null;
-
- if (authToken != null) {
- authenticated = authenticationTokenValidator.validate(authToken);
- }
-
- return authenticated;
- }
-
- protected void populateScope(Scope authenticatedScope, Authentication authenticated) throws Exception {
- authenticatedScope.put(Authentication.class, authenticated);
- }
-
- @Override
- public void destroy() {
-
- }
-
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
-
- }
+ static final Logger log = Logger.getLogger(OpenstackAuthenticationFilterBase.class);
+
+ private final AuthenticationTokenValidator authenticationTokenValidator;
+
+ protected OpenstackAuthenticationFilterBase(AuthenticationTokenValidator authenticationTokenValidator) {
+ this.authenticationTokenValidator = authenticationTokenValidator;
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
+ throws IOException, ServletException {
+ Scope authenticatedScope = Scope.inherit();
+
+ // Fail safe
+ authenticatedScope.put(Authentication.class, null);
+
+ if (servletRequest instanceof HttpServletRequest) {
+ HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+ HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
+
+ try {
+ Authentication authenticated = attemptAuthentication(httpServletRequest);
+
+ if (authenticated == null) {
+ httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ return;
+ } else {
+ populateScope(authenticatedScope, authenticated);
+ }
+ } catch (SecurityException e) {
+ httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ return;
+ } catch (Exception e) {
+ // If we're down, don't tell the user that their password is wrong
+ log.warn("Unexpected error in authentication filter", e);
+ httpServletResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ }
+
+ authenticatedScope.push();
+ try {
+ filterChain.doFilter(servletRequest, servletResponse);
+ } finally {
+ authenticatedScope.pop();
+ }
+ }
+
+ protected Authentication attemptAuthentication(HttpServletRequest httpServletRequest) throws Exception {
+ String authToken = httpServletRequest.getHeader("X-Auth-Token");
+
+ Authentication authenticated = null;
+
+ if (authToken != null) {
+ authenticated = authenticationTokenValidator.validate(authToken);
+ }
+
+ return authenticated;
+ }
+
+ protected void populateScope(Scope authenticatedScope, Authentication authenticated) throws Exception {
+ authenticatedScope.put(Authentication.class, authenticated);
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+
+ }
}
View
145 auth/client/src/main/java/org/openstack/keystone/service/RestfulClient.java
@@ -19,76 +19,77 @@
import org.platformlayer.xml.UnmarshalException;
public class RestfulClient {
- static final Logger log = Logger.getLogger(RestfulClient.class);
-
- final String baseUrl;
-
- public RestfulClient(String baseUrl) {
- this.baseUrl = baseUrl;
- }
-
- protected <T> T doSimpleRequest(String method, String relativeUri, Object postObject, Class<T> responseClass) throws PlatformLayerClientException {
- try {
- URI uri = new URI(baseUrl + relativeUri);
-
- log.info("HTTP Request: " + method + " " + uri);
-
- SimpleHttpRequest httpRequest = SimpleHttpRequest.build(method, uri);
- httpRequest.setRequestHeader("Accept", "application/xml");
-
- addHeaders(httpRequest);
-
- if (postObject != null) {
- httpRequest.setRequestHeader("Content-Type", "application/xml");
- String xml = serializeXml(postObject);
- httpRequest.getOutputStream().write(Utf8.getBytes(xml));
- }
-
- SimpleHttpResponse response = httpRequest.doRequest();
-
- int responseCode = response.getHttpResponseCode();
- switch (responseCode) {
- case 401:
- throw new KeystoneAuthenticationException("Authentication failure");
-
- case 200:
- case 203: {
- if (responseClass.equals(String.class)) {
- return CastUtils.as(IoUtils.readAll(response.getInputStream()), responseClass);
- } else {
- return deserializeXml(response.getInputStream(), responseClass);
- }
- }
-
- default:
- throw new PlatformLayerClientException("Unexpected result code: " + responseCode, null, responseCode);
- }
- } catch (IOException e) {
- throw new KeystoneAuthenticationException("Error communicating with service", e);
- } catch (URISyntaxException e) {
- throw new KeystoneAuthenticationException("Error building URI", e);
- }
-
- }
-
- protected void addHeaders(SimpleHttpRequest httpRequest) {
-
- }
-
- <T> T deserializeXml(InputStream is, Class<T> clazz) throws KeystoneAuthenticationException {
- try {
- return JaxbHelper.deserializeXmlObject(is, clazz, true);
- } catch (UnmarshalException e) {
- throw new KeystoneAuthenticationException("Error reading authentication response data", e);
- }
- }
-
- String serializeXml(Object object) throws KeystoneAuthenticationException {
- try {
- boolean formatted = false;
- return JaxbHelper.toXml(object, formatted);
- } catch (JAXBException e) {
- throw new KeystoneAuthenticationException("Error serializing data", e);
- }
- }
+ static final Logger log = Logger.getLogger(RestfulClient.class);
+
+ final String baseUrl;
+
+ public RestfulClient(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+
+ protected <T> T doSimpleRequest(String method, String relativeUri, Object postObject, Class<T> responseClass)
+ throws PlatformLayerClientException {
+ try {
+ URI uri = new URI(baseUrl + relativeUri);
+
+ log.info("HTTP Request: " + method + " " + uri);
+
+ SimpleHttpRequest httpRequest = SimpleHttpRequest.build(method, uri);
+ httpRequest.setRequestHeader("Accept", "application/xml");
+
+ addHeaders(httpRequest);
+
+ if (postObject != null) {
+ httpRequest.setRequestHeader("Content-Type", "application/xml");
+ String xml = serializeXml(postObject);
+ httpRequest.getOutputStream().write(Utf8.getBytes(xml));
+ }
+
+ SimpleHttpResponse response = httpRequest.doRequest();
+
+ int responseCode = response.getHttpResponseCode();
+ switch (responseCode) {
+ case 401:
+ throw new KeystoneAuthenticationException("Authentication failure");
+
+ case 200:
+ case 203: {
+ if (responseClass.equals(String.class)) {
+ return CastUtils.as(IoUtils.readAll(response.getInputStream()), responseClass);
+ } else {
+ return deserializeXml(response.getInputStream(), responseClass);
+ }
+ }
+
+ default:
+ throw new PlatformLayerClientException("Unexpected result code: " + responseCode, null, responseCode);
+ }
+ } catch (IOException e) {
+ throw new KeystoneAuthenticationException("Error communicating with service", e);
+ } catch (URISyntaxException e) {
+ throw new KeystoneAuthenticationException("Error building URI", e);
+ }
+
+ }
+
+ protected void addHeaders(SimpleHttpRequest httpRequest) {
+
+ }
+
+ <T> T deserializeXml(InputStream is, Class<T> clazz) throws KeystoneAuthenticationException {
+ try {
+ return JaxbHelper.deserializeXmlObject(is, clazz, true);
+ } catch (UnmarshalException e) {
+ throw new KeystoneAuthenticationException("Error reading authentication response data", e);
+ }
+ }
+
+ String serializeXml(Object object) throws KeystoneAuthenticationException {
+ try {
+ boolean formatted = false;
+ return JaxbHelper.toXml(object, formatted);
+ } catch (JAXBException e) {
+ throw new KeystoneAuthenticationException("Error serializing data", e);
+ }
+ }
}
View
4 auth/client/src/main/java/org/platformlayer/auth/AuthenticationToken.java
@@ -3,7 +3,7 @@
import org.platformlayer.http.SimpleHttpRequest;
public interface AuthenticationToken {
- String getServiceUrl(String serviceKey);
+ String getServiceUrl(String serviceKey);
- void populateRequest(SimpleHttpRequest httpRequest);
+ void populateRequest(SimpleHttpRequest httpRequest);
}
View
6 auth/client/src/main/java/org/platformlayer/auth/Authenticator.java
@@ -1,9 +1,9 @@
package org.platformlayer.auth;
public interface Authenticator {
- AuthenticationToken getAuthenticationToken() throws OpenstackAuthenticationException;
+ AuthenticationToken getAuthenticationToken() throws OpenstackAuthenticationException;
- void clearAuthenticationToken();
+ void clearAuthenticationToken();
- String getHost();
+ String getHost();
}
View
14 auth/client/src/main/java/org/platformlayer/auth/OpenstackAuthenticationException.java
@@ -3,13 +3,13 @@
import org.platformlayer.PlatformLayerClientException;
public class OpenstackAuthenticationException extends PlatformLayerClientException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public OpenstackAuthenticationException(String message) {
- super(message);
- }
+ public OpenstackAuthenticationException(String message) {
+ super(message);
+ }
- public OpenstackAuthenticationException(String message, Exception e) {
- super(message, e);
- }
+ public OpenstackAuthenticationException(String message, Exception e) {
+ super(message, e);
+ }
}
View
204 auth/client/src/main/java/org/platformlayer/auth/test/OpenstackAuthenticationClient.java
@@ -16,105 +16,109 @@
import org.slf4j.LoggerFactory;
public class OpenstackAuthenticationClient {
- static final Logger log = LoggerFactory.getLogger(OpenstackAuthenticationClient.class);
+ static final Logger log = LoggerFactory.getLogger(OpenstackAuthenticationClient.class);
- final String username;
- final private String secret;
-
- OpenstackAuthenticationToken authenticationToken;
-
- private String authenticationUrl = URL_AUTHENTICATE;
-
- static final String URL_AUTHENTICATE = "https://auth.api.rackspacecloud.com/v1.0";
-
- public static final Integer HTTP_500_ERROR = new Integer(500);
-
- protected static final int MAX_RETRIES = 10;
-
- static Random random = new Random();
-
- public OpenstackAuthenticationClient(String username, String secret) {
- this.username = username;
- this.secret = secret;
- }
-
- public synchronized OpenstackAuthenticationToken getAuthenticationToken() throws OpenstackAuthenticationException {
- if (authenticationToken == null)
- authenticationToken = authenticate();
-
- return authenticationToken;
- }
-
- private OpenstackAuthenticationToken authenticate() throws OpenstackAuthenticationException {
- if (username == null || secret == null) {
- throw new OpenstackAuthenticationException("Username and secret are both required");
- }
-
- try {
- // GET /v1.0 HTTP/1.1
- // Host: auth.api.rackspacecloud.com
- // X-Auth-User: jdoe
- // X-Auth-Key: a86850deb2742ec3cb41518e26aa2d89
- URI uri = new URI(authenticationUrl);
-
- SimpleHttpRequest httpRequest = SimpleHttpRequest.build("GET", uri);
- httpRequest.setRequestHeader("X-Auth-User", this.username);
- httpRequest.setRequestHeader("X-Auth-Key", this.secret);
-
- SimpleHttpResponse response = httpRequest.doRequest();
-
- int responseCode = response.getHttpResponseCode();
- switch (responseCode) {
- case 401:
- throw new OpenstackAuthenticationException("Openstack credentials were not correct");
-
- case 204:
- /*
- * If authentication is successful, an HTTP status 204 No Content is returned with three cloud service headers, X-Server-Management-Url, X-Storage-Url, X-CDN-Management-Url, as well as
- * X-Auth-Token
- */
-
- String authToken = getRequiredHeader(response, "X-Auth-Token");
-
- Map<String, String> allHeaders = response.getHeadersRemoveDuplicates();
-
- return new OpenstackAuthenticationToken(authToken, allHeaders);
-
- default:
- throw new OpenstackAuthenticationException("Unexpected return code from Rackspace Cloud during login: " + responseCode);
- }
- } catch (IOException e) {
- throw new OpenstackAuthenticationException("Error communicating with authentication service", e);
- } catch (URISyntaxException e) {
- throw new OpenstackAuthenticationException("Error building rackspace URI", e);
- }
- }
-
- private static String getRequiredHeader(SimpleHttpResponse response, String headerName) throws OpenstackAuthenticationException {
- String headerValue = response.getResponseHeaderField(headerName);
- if (headerValue == null)
- throw new OpenstackAuthenticationException("Did not find required header: " + headerName);
- return headerValue;
- }
-
- public static <T> T deserializeXml(InputStream is, Class<T> clazz) throws OpenstackAuthenticationException {
- try {
- return JaxbHelper.deserializeXmlObject(is, clazz, true);
- } catch (UnmarshalException e) {
- throw new OpenstackAuthenticationException("Error reading authentication response data", e);
- }
- }
-
- public String getAuthenticationUrl() {
- return authenticationUrl;
- }
-
- public void setAuthenticationUrl(String authenticationUrl) {
- this.authenticationUrl = authenticationUrl;
- }
-
- public OpenstackAuthenticationToken reauthenticate() throws OpenstackAuthenticationException {
- this.authenticationToken = null;
- return getAuthenticationToken();
- }
+ final String username;
+ final private String secret;
+
+ OpenstackAuthenticationToken authenticationToken;
+
+ private String authenticationUrl = URL_AUTHENTICATE;
+
+ static final String URL_AUTHENTICATE = "https://auth.api.rackspacecloud.com/v1.0";
+
+ public static final Integer HTTP_500_ERROR = new Integer(500);
+
+ protected static final int MAX_RETRIES = 10;
+
+ static Random random = new Random();
+
+ public OpenstackAuthenticationClient(String username, String secret) {
+ this.username = username;
+ this.secret = secret;
+ }
+
+ public synchronized OpenstackAuthenticationToken getAuthenticationToken() throws OpenstackAuthenticationException {
+ if (authenticationToken == null) {
+ authenticationToken = authenticate();
+ }
+
+ return authenticationToken;
+ }
+
+ private OpenstackAuthenticationToken authenticate() throws OpenstackAuthenticationException {
+ if (username == null || secret == null) {
+ throw new OpenstackAuthenticationException("Username and secret are both required");
+ }
+
+ try {
+ // GET /v1.0 HTTP/1.1
+ // Host: auth.api.rackspacecloud.com
+ // X-Auth-User: jdoe
+ // X-Auth-Key: a86850deb2742ec3cb41518e26aa2d89
+ URI uri = new URI(authenticationUrl);
+
+ SimpleHttpRequest httpRequest = SimpleHttpRequest.build("GET", uri);
+ httpRequest.setRequestHeader("X-Auth-User", this.username);
+ httpRequest.setRequestHeader("X-Auth-Key", this.secret);
+
+ SimpleHttpResponse response = httpRequest.doRequest();
+
+ int responseCode = response.getHttpResponseCode();
+ switch (responseCode) {
+ case 401:
+ throw new OpenstackAuthenticationException("Openstack credentials were not correct");
+
+ case 204:
+ /*
+ * If authentication is successful, an HTTP status 204 No Content is returned with three cloud service
+ * headers, X-Server-Management-Url, X-Storage-Url, X-CDN-Management-Url, as well as X-Auth-Token
+ */
+
+ String authToken = getRequiredHeader(response, "X-Auth-Token");
+
+ Map<String, String> allHeaders = response.getHeadersRemoveDuplicates();
+
+ return new OpenstackAuthenticationToken(authToken, allHeaders);
+
+ default:
+ throw new OpenstackAuthenticationException("Unexpected return code from Rackspace Cloud during login: "
+ + responseCode);
+ }
+ } catch (IOException e) {
+ throw new OpenstackAuthenticationException("Error communicating with authentication service", e);
+ } catch (URISyntaxException e) {
+ throw new OpenstackAuthenticationException("Error building rackspace URI", e);
+ }
+ }
+
+ private static String getRequiredHeader(SimpleHttpResponse response, String headerName)
+ throws OpenstackAuthenticationException {
+ String headerValue = response.getResponseHeaderField(headerName);
+ if (headerValue == null) {
+ throw new OpenstackAuthenticationException("Did not find required header: " + headerName);
+ }
+ return headerValue;
+ }
+
+ public static <T> T deserializeXml(InputStream is, Class<T> clazz) throws OpenstackAuthenticationException {
+ try {
+ return JaxbHelper.deserializeXmlObject(is, clazz, true);
+ } catch (UnmarshalException e) {
+ throw new OpenstackAuthenticationException("Error reading authentication response data", e);
+ }
+ }
+
+ public String getAuthenticationUrl() {
+ return authenticationUrl;
+ }
+
+ public void setAuthenticationUrl(String authenticationUrl) {
+ this.authenticationUrl = authenticationUrl;
+ }
+
+ public OpenstackAuthenticationToken reauthenticate() throws OpenstackAuthenticationException {
+ this.authenticationToken = null;
+ return getAuthenticationToken();
+ }
}
View
24 auth/client/src/main/java/org/platformlayer/auth/test/OpenstackAuthenticationToken.java
@@ -3,20 +3,20 @@
import java.util.Map;
public class OpenstackAuthenticationToken {
- private final String authToken;
- private final Map<String, String> allHeaders;
+ private final String authToken;
+ private final Map<String, String> allHeaders;
- public OpenstackAuthenticationToken(String authToken, Map<String, String> allHeaders) {
- this.authToken = authToken;
- this.allHeaders = allHeaders;
- }
+ public OpenstackAuthenticationToken(String authToken, Map<String, String> allHeaders) {
+ this.authToken = authToken;
+ this.allHeaders = allHeaders;
+ }
- public String getHeaderValue(String key) {
- return allHeaders.get(key);
- }
+ public String getHeaderValue(String key) {
+ return allHeaders.get(key);
+ }
- public String getAuthTokenValue() {
- return authToken;
- }
+ public String getAuthTokenValue() {
+ return authToken;
+ }
}
View
24 auth/keystone-api/src/main/java/org/openstack/keystone/services/AuthenticationInfo.java
@@ -1,19 +1,19 @@
package org.openstack.keystone.services;
public class AuthenticationInfo {
- final String userId;
- final byte[] tokenSecret;
+ final String userId;
+ final byte[] tokenSecret;
- public AuthenticationInfo(String userId, byte[] tokenSecret) {
- this.userId = userId;
- this.tokenSecret = tokenSecret;
- }
+ public AuthenticationInfo(String userId, byte[] tokenSecret) {
+ this.userId = userId;
+ this.tokenSecret = tokenSecret;
+ }
- public String getUserId() {
- return userId;
- }
+ public String getUserId() {
+ return userId;
+ }
- public byte[] getTokenSecret() {
- return tokenSecret;
- }
+ public byte[] getTokenSecret() {
+ return tokenSecret;
+ }
}
View
14 auth/keystone-api/src/main/java/org/openstack/keystone/services/AuthenticatorException.java
@@ -2,14 +2,14 @@
public class AuthenticatorException extends Exception {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public AuthenticatorException(String message, Throwable cause) {
- super(message, cause);
- }
+ public AuthenticatorException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public AuthenticatorException(String message) {
- super(message);
- }
+ public AuthenticatorException(String message) {
+ super(message);
+ }
}
View
6 auth/keystone-api/src/main/java/org/openstack/keystone/services/GenericAuthenticator.java
@@ -1,9 +1,9 @@
package org.openstack.keystone.services;
public interface GenericAuthenticator {
- AuthenticationInfo authenticate(String username, String password) throws AuthenticatorException;
+ AuthenticationInfo authenticate(String username, String password) throws AuthenticatorException;
- GroupMembershipOracle getGroupMembership();
+ GroupMembershipOracle getGroupMembership();
- byte[] getUserSecret(String userId, byte[] tokenSecret) throws AuthenticatorException;
+ byte[] getUserSecret(String userId, byte[] tokenSecret) throws AuthenticatorException;
}
View
2 auth/keystone-api/src/main/java/org/openstack/keystone/services/GroupMembershipOracle.java
@@ -3,5 +3,5 @@
import java.util.List;
public interface GroupMembershipOracle {
- List<String> getGroups(String key, boolean isGroup) throws AuthenticatorException;
+ List<String> getGroups(String key, boolean isGroup) throws AuthenticatorException;
}
View
32 ...eystone-api/src/main/java/org/openstack/keystone/services/SystemAuthenticatorAdaptor.java
@@ -1,24 +1,24 @@
package org.openstack.keystone.services;
public class SystemAuthenticatorAdaptor implements SystemAuthenticator {
- final GenericAuthenticator authenticator;
+ final GenericAuthenticator authenticator;
- public SystemAuthenticatorAdaptor(GenericAuthenticator authenticator) {
- this.authenticator = authenticator;
- }
+ public SystemAuthenticatorAdaptor(GenericAuthenticator authenticator) {
+ this.authenticator = authenticator;
+ }
- @Override
- public AuthenticationInfo authenticate(String username, String password) throws AuthenticatorException {
- return authenticator.authenticate(username, password);
- }
+ @Override
+ public AuthenticationInfo authenticate(String username, String password) throws AuthenticatorException {
+ return authenticator.authenticate(username, password);
+ }
- @Override
- public GroupMembershipOracle getGroupMembership() {
- return authenticator.getGroupMembership();
- }
+ @Override
+ public GroupMembershipOracle getGroupMembership() {
+ return authenticator.getGroupMembership();
+ }
- @Override
- public byte[] getUserSecret(String userId, byte[] tokenSecret) throws AuthenticatorException {
- return authenticator.getUserSecret(userId, tokenSecret);
- }
+ @Override
+ public byte[] getUserSecret(String userId, byte[] tokenSecret) throws AuthenticatorException {
+ return authenticator.getUserSecret(userId, tokenSecret);
+ }
}
View
32 .../keystone-api/src/main/java/org/openstack/keystone/services/UserAuthenticatorAdaptor.java
@@ -1,24 +1,24 @@
package org.openstack.keystone.services;
public class UserAuthenticatorAdaptor implements UserAuthenticator {
- final GenericAuthenticator authenticator;
+ final GenericAuthenticator authenticator;
- public UserAuthenticatorAdaptor(GenericAuthenticator authenticator) {
- this.authenticator = authenticator;
- }
+ public UserAuthenticatorAdaptor(GenericAuthenticator authenticator) {
+ this.authenticator = authenticator;
+ }
- @Override
- public AuthenticationInfo authenticate(String username, String password) throws AuthenticatorException {
- return authenticator.authenticate(username, password);
- }
+ @Override
+ public AuthenticationInfo authenticate(String username, String password) throws AuthenticatorException {
+ return authenticator.authenticate(username, password);
+ }
- @Override
- public GroupMembershipOracle getGroupMembership() {
- return authenticator.getGroupMembership();
- }
+ @Override
+ public GroupMembershipOracle getGroupMembership() {
+ return authenticator.getGroupMembership();
+ }
- @Override
- public byte[] getUserSecret(String userId, byte[] tokenSecret) throws AuthenticatorException {
- return authenticator.getUserSecret(userId, tokenSecret);
- }
+ @Override
+ public byte[] getUserSecret(String userId, byte[] tokenSecret) throws AuthenticatorException {
+ return authenticator.getUserSecret(userId, tokenSecret);
+ }
}
View
62 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/KeystoneCli.java
@@ -14,36 +14,36 @@
import com.martiansoftware.nailgun.NGContext;
public class KeystoneCli extends CliBase {
- static class PlatformLayerCliHandler implements CliHandler {
- @Override
- public CliOptions buildOptionsBean() {
- return new KeystoneCliOptions();
- }
-
- @Override
- public CliContext buildContext(CommandRegistry commandRegistry, CliOptions options) throws Exception {
- return new KeystoneCliContext((KeystoneCommandRegistry) commandRegistry, (KeystoneCliOptions) options);
- }
-
- @Override
- public CommandRegistry buildCommandRegistry() {
- return new KeystoneCommandRegistry();
- }
- }
-
- static {
- CmdLineParser.registerHandler(UserName.class, StringWrapperOptionHandler.class);
- CmdLineParser.registerHandler(ProjectName.class, StringWrapperOptionHandler.class);
-
- init(new PlatformLayerCliHandler());
- }
-
- public static void main(String[] args) {
- CliBase.main(args);
- }
-
- public static void nailMain(NGContext nailgunContext) {
- CliBase.nailMain(nailgunContext);
- }
+ static class PlatformLayerCliHandler implements CliHandler {
+ @Override
+ public CliOptions buildOptionsBean() {
+ return new KeystoneCliOptions();
+ }
+
+ @Override
+ public CliContext buildContext(CommandRegistry commandRegistry, CliOptions options) throws Exception {
+ return new KeystoneCliContext((KeystoneCommandRegistry) commandRegistry, (KeystoneCliOptions) options);
+ }
+
+ @Override
+ public CommandRegistry buildCommandRegistry() {
+ return new KeystoneCommandRegistry();
+ }
+ }
+
+ static {
+ CmdLineParser.registerHandler(UserName.class, StringWrapperOptionHandler.class);
+ CmdLineParser.registerHandler(ProjectName.class, StringWrapperOptionHandler.class);
+
+ init(new PlatformLayerCliHandler());
+ }
+
+ public static void main(String[] args) {
+ CliBase.main(args);
+ }
+
+ public static void nailMain(NGContext nailgunContext) {
+ CliBase.nailMain(nailgunContext);
+ }
}
View
129 auth/keystone-cli/src/main/java/org/platformlayer/keystone/cli/KeystoneCliOptions.java
@@ -14,68 +14,71 @@
import com.fathomdb.cli.CliOptions;
public class KeystoneCliOptions extends CliOptions {
- @Option(name = "-c", aliases = "--config", usage = "specify configuration file")
- String configFile;
-
- @Option(name = "-u", aliases = "--username", usage = "login username")
- String username;
-
- @Option(name = "-p", aliases = "--password", usage = "login password")
- String password;
-
- Properties config;
-
- public Properties getConfigurationProperties() {
- if (config == null) {
- Properties build = new Properties();
-
- if (configFile != null) {
- InputStream is = null;
- try {
- if (configFile.equals("-")) {
- // Read from stdin
- // Don't auto-close it, and that terminates nailgun
- is = new NoCloseInputStream(System.in);
- } else {
- if (isServerMode()) {
- throw new IllegalArgumentException("Must pass config file over stdin in server mode");
- }
- File file = new File(configFile);
- if (!file.exists())
- throw new FileNotFoundException("Configuration file not found: " + file);
-
- is = new FileInputStream(file);
- }
-
- try {
- build.load(is);
- } catch (IOException e) {
- throw new IOException("Error reading configuration file", e);
- }
- } catch (IOException e) {
- throw new IllegalArgumentException("Error reading configuration file", e);
- } finally {
- Io.safeClose(is);
- }
- }
-
- if (this.username != null)
- build.setProperty("platformlayer.username", this.username);
- if (this.password != null)
- build.setProperty("platformlayer.password", this.password);
-
- this.config = build;
- }
-
- return config;
- }
-
- public String getUsername() {
- return getConfigurationProperties().getProperty("platformlayer.username");
- }
-
- public String getPassword() {
- return getConfigurationProperties().getProperty("platformlayer.password");
- }
+ @Option(name = "-c", aliases = "--config", usage = "specify configuration file")
+ String configFile;
+
+ @Option(name = "-u", aliases = "--username", usage = "login username")
+ String username;
+
+ @Option(name = "-p", aliases = "--password", usage = "login password")
+ String password;
+
+ Properties config;
+
+ public Properties getConfigurationProperties() {
+ if (config == null) {
+ Properties build = new Properties();
+
+ if (configFile != null) {
+ InputStream is = null;
+ try {
+ if (configFile.equals("-")) {
+ // Read from stdin
+ // Don't auto-close it, and that terminates nailgun
+ is = new NoCloseInputStream(System.in);
+ } else {
+ if (isServerMode()) {
+ throw new IllegalArgumentException("Must pass config file over stdin in server mode");
+ }
+ File file = new File(configFile);
+ if (!file.exists()) {
+ throw new FileNotFoundException("Configuration file not found: " + file);
+ }
+
+ is = new FileInputStream(file);
+ }
+