From 68e094ebaf6ce0c3280c9b6c191f1c389758e8f9 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sun, 24 Aug 2014 15:51:29 +0200 Subject: [PATCH] saml: move refactor files from server to api module - Move interfaces and classes from server to api module - This can be then used for pluggable api authenticators Signed-off-by: Rohit Yadav --- .../src/org/apache/cloudstack}/api/ApiServerService.java | 2 +- .../cloudstack}/api/auth/APIAuthenticationManager.java | 2 +- .../cloudstack}/api/auth/APIAuthenticationType.java | 2 +- .../org/apache/cloudstack}/api/auth/APIAuthenticator.java | 2 +- .../api/command}/SAML2LoginAPIAuthenticatorCmd.java | 8 +++++--- .../api/command}/SAML2LogoutAPIAuthenticatorCmd.java | 4 +++- .../cloudstack/{ => saml}/SAML2UserAuthenticator.java | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) rename {server/src/com/cloud => api/src/org/apache/cloudstack}/api/ApiServerService.java (98%) rename {server/src/com/cloud => api/src/org/apache/cloudstack}/api/auth/APIAuthenticationManager.java (96%) rename {server/src/com/cloud => api/src/org/apache/cloudstack}/api/auth/APIAuthenticationType.java (95%) rename {server/src/com/cloud => api/src/org/apache/cloudstack}/api/auth/APIAuthenticator.java (97%) rename {server/src/com/cloud/api/auth => plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command}/SAML2LoginAPIAuthenticatorCmd.java (98%) rename {server/src/com/cloud/api/auth => plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command}/SAML2LogoutAPIAuthenticatorCmd.java (94%) rename plugins/user-authenticators/saml2/src/org/apache/cloudstack/{ => saml}/SAML2UserAuthenticator.java (98%) diff --git a/server/src/com/cloud/api/ApiServerService.java b/api/src/org/apache/cloudstack/api/ApiServerService.java similarity index 98% rename from server/src/com/cloud/api/ApiServerService.java rename to api/src/org/apache/cloudstack/api/ApiServerService.java index aa3b8f776c7..9c0cfa39d79 100644 --- a/server/src/com/cloud/api/ApiServerService.java +++ b/api/src/org/apache/cloudstack/api/ApiServerService.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api; +package org.apache.cloudstack.api; import com.cloud.exception.CloudAuthenticationException; import org.apache.cloudstack.api.ResponseObject; diff --git a/server/src/com/cloud/api/auth/APIAuthenticationManager.java b/api/src/org/apache/cloudstack/api/auth/APIAuthenticationManager.java similarity index 96% rename from server/src/com/cloud/api/auth/APIAuthenticationManager.java rename to api/src/org/apache/cloudstack/api/auth/APIAuthenticationManager.java index 7fd4da92a59..5d4d664538c 100644 --- a/server/src/com/cloud/api/auth/APIAuthenticationManager.java +++ b/api/src/org/apache/cloudstack/api/auth/APIAuthenticationManager.java @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package com.cloud.api.auth; +package org.apache.cloudstack.api.auth; import com.cloud.utils.component.PluggableService; diff --git a/server/src/com/cloud/api/auth/APIAuthenticationType.java b/api/src/org/apache/cloudstack/api/auth/APIAuthenticationType.java similarity index 95% rename from server/src/com/cloud/api/auth/APIAuthenticationType.java rename to api/src/org/apache/cloudstack/api/auth/APIAuthenticationType.java index bdd37ec5e79..e8c7f0f5eda 100644 --- a/server/src/com/cloud/api/auth/APIAuthenticationType.java +++ b/api/src/org/apache/cloudstack/api/auth/APIAuthenticationType.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.auth; +package org.apache.cloudstack.api.auth; public enum APIAuthenticationType { LOGIN_API, LOGOUT_API diff --git a/server/src/com/cloud/api/auth/APIAuthenticator.java b/api/src/org/apache/cloudstack/api/auth/APIAuthenticator.java similarity index 97% rename from server/src/com/cloud/api/auth/APIAuthenticator.java rename to api/src/org/apache/cloudstack/api/auth/APIAuthenticator.java index 90cd7ec7a8a..20fe61f7fbf 100644 --- a/server/src/com/cloud/api/auth/APIAuthenticator.java +++ b/api/src/org/apache/cloudstack/api/auth/APIAuthenticator.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.auth; +package org.apache.cloudstack.api.auth; import org.apache.cloudstack.api.ServerApiException; diff --git a/server/src/com/cloud/api/auth/SAML2LoginAPIAuthenticatorCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java similarity index 98% rename from server/src/com/cloud/api/auth/SAML2LoginAPIAuthenticatorCmd.java rename to plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java index ce97cfd71d3..611c69b33dc 100644 --- a/server/src/com/cloud/api/auth/SAML2LoginAPIAuthenticatorCmd.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java @@ -15,9 +15,9 @@ // specific language governing permissions and limitations // under the License. -package com.cloud.api.auth; +package org.apache.cloudstack.api.command; -import com.cloud.api.ApiServerService; +import org.apache.cloudstack.api.ApiServerService; import com.cloud.api.response.ApiResponseSerializer; import com.cloud.exception.CloudAuthenticationException; import com.cloud.user.Account; @@ -30,6 +30,8 @@ import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.auth.APIAuthenticationType; +import org.apache.cloudstack.api.auth.APIAuthenticator; import org.apache.cloudstack.api.response.LoginCmdResponse; import org.apache.cloudstack.context.CallContext; import org.apache.log4j.Logger; @@ -187,7 +189,7 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthent authnRequest.setIssuer(issuer); authnRequest.setIssueInstant(new DateTime()); authnRequest.setProviderName("Apache CloudStack"); - authnRequest.setProtocolBinding(SAMLConstants.SAML2_REDIRECT_BINDING_URI); //SAML2_ARTIFACT_BINDING_URI); + authnRequest.setProtocolBinding(SAMLConstants.SAML2_REDIRECT_BINDING_URI); authnRequest.setAssertionConsumerServiceURL(consumerUrl); authnRequest.setNameIDPolicy(nameIdPolicy); authnRequest.setRequestedAuthnContext(requestedAuthnContext); diff --git a/server/src/com/cloud/api/auth/SAML2LogoutAPIAuthenticatorCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LogoutAPIAuthenticatorCmd.java similarity index 94% rename from server/src/com/cloud/api/auth/SAML2LogoutAPIAuthenticatorCmd.java rename to plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LogoutAPIAuthenticatorCmd.java index 91195887424..b82f2c81909 100644 --- a/server/src/com/cloud/api/auth/SAML2LogoutAPIAuthenticatorCmd.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LogoutAPIAuthenticatorCmd.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.auth; +package org.apache.cloudstack.api.command; import com.cloud.api.response.ApiResponseSerializer; import com.cloud.user.Account; @@ -22,6 +22,8 @@ import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.auth.APIAuthenticationType; +import org.apache.cloudstack.api.auth.APIAuthenticator; import org.apache.cloudstack.api.response.LogoutCmdResponse; import org.apache.log4j.Logger; diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/SAML2UserAuthenticator.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2UserAuthenticator.java similarity index 98% rename from plugins/user-authenticators/saml2/src/org/apache/cloudstack/SAML2UserAuthenticator.java rename to plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2UserAuthenticator.java index 4d4f1d3e8d1..1a37f65c057 100644 --- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/SAML2UserAuthenticator.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2UserAuthenticator.java @@ -12,7 +12,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -package org.apache.cloudstack; +package org.apache.cloudstack.saml; import com.cloud.server.auth.DefaultUserAuthenticator; import com.cloud.server.auth.UserAuthenticator;