mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-18 03:23:45 +01:00
server: fix server package after auth plugin refactor
- Have opensaml dependency to get version from root pom - add com.cloud.api.auth.APIAuthenticationManagerImpl to spring ctx manager - Fix getCommands() in APIAuthenticationManagerImpl - Fix imports in resources, test and src classes Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
4422fdd9ad
commit
591a686d77
@ -136,7 +136,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.opensaml</groupId>
|
<groupId>org.opensaml</groupId>
|
||||||
<artifactId>opensaml</artifactId>
|
<artifactId>opensaml</artifactId>
|
||||||
<version>2.6.1</version>
|
<version>${cs.opensaml.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -32,7 +32,10 @@
|
|||||||
http://www.springframework.org/schema/util/spring-util-3.0.xsd"
|
http://www.springframework.org/schema/util/spring-util-3.0.xsd"
|
||||||
>
|
>
|
||||||
|
|
||||||
<bean id="authenticationManagerImpl" class="com.cloud.api.auth.APIAuthenticationManagerImpl" />
|
<bean id="authenticationManagerImpl" class="com.cloud.api.auth.APIAuthenticationManagerImpl">
|
||||||
|
<property name="apiAuthenticators"
|
||||||
|
value="#{pluggableAPIAuthenticatorsRegistry.registered}" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="accountManagerImpl" class="com.cloud.user.AccountManagerImpl">
|
<bean id="accountManagerImpl" class="com.cloud.user.AccountManagerImpl">
|
||||||
<property name="userAuthenticators"
|
<property name="userAuthenticators"
|
||||||
|
|||||||
@ -16,9 +16,9 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.api;
|
package com.cloud.api;
|
||||||
|
|
||||||
import com.cloud.api.auth.APIAuthenticationManager;
|
import org.apache.cloudstack.api.auth.APIAuthenticationManager;
|
||||||
import com.cloud.api.auth.APIAuthenticationType;
|
import org.apache.cloudstack.api.auth.APIAuthenticationType;
|
||||||
import com.cloud.api.auth.APIAuthenticator;
|
import org.apache.cloudstack.api.auth.APIAuthenticator;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.AccountService;
|
import com.cloud.user.AccountService;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
@ -26,6 +26,7 @@ import com.cloud.utils.HttpUtils;
|
|||||||
import com.cloud.utils.StringUtils;
|
import com.cloud.utils.StringUtils;
|
||||||
import com.cloud.utils.db.EntityManager;
|
import com.cloud.utils.db.EntityManager;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiServerService;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
import org.apache.cloudstack.managed.context.ManagedContext;
|
import org.apache.cloudstack.managed.context.ManagedContext;
|
||||||
|
|||||||
@ -19,6 +19,9 @@ package com.cloud.api.auth;
|
|||||||
import com.cloud.utils.component.ComponentContext;
|
import com.cloud.utils.component.ComponentContext;
|
||||||
import com.cloud.utils.component.ManagerBase;
|
import com.cloud.utils.component.ManagerBase;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
|
import org.apache.cloudstack.api.auth.APIAuthenticationManager;
|
||||||
|
import org.apache.cloudstack.api.auth.APIAuthenticator;
|
||||||
|
import org.apache.cloudstack.api.auth.PluggableAPIAuthenticator;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
@ -32,12 +35,21 @@ import java.util.Map;
|
|||||||
public class APIAuthenticationManagerImpl extends ManagerBase implements APIAuthenticationManager {
|
public class APIAuthenticationManagerImpl extends ManagerBase implements APIAuthenticationManager {
|
||||||
public static final Logger s_logger = Logger.getLogger(APIAuthenticationManagerImpl.class.getName());
|
public static final Logger s_logger = Logger.getLogger(APIAuthenticationManagerImpl.class.getName());
|
||||||
|
|
||||||
|
private List<PluggableAPIAuthenticator> _apiAuthenticators;
|
||||||
|
|
||||||
private static Map<String, Class<?>> s_authenticators = null;
|
private static Map<String, Class<?>> s_authenticators = null;
|
||||||
private static List<Class<?>> s_commandList = null;
|
|
||||||
|
|
||||||
public APIAuthenticationManagerImpl() {
|
public APIAuthenticationManagerImpl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PluggableAPIAuthenticator> getApiAuthenticators() {
|
||||||
|
return _apiAuthenticators;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiAuthenticators(List<PluggableAPIAuthenticator> authenticators) {
|
||||||
|
_apiAuthenticators = authenticators;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean start() {
|
public boolean start() {
|
||||||
s_authenticators = new HashMap<String, Class<?>>();
|
s_authenticators = new HashMap<String, Class<?>>();
|
||||||
@ -53,14 +65,13 @@ public class APIAuthenticationManagerImpl extends ManagerBase implements APIAuth
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Class<?>> getCommands() {
|
public List<Class<?>> getCommands() {
|
||||||
if (s_commandList == null) {
|
List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||||
s_commandList = new ArrayList<Class<?>>();
|
cmdList.add(DefaultLoginAPIAuthenticatorCmd.class);
|
||||||
s_commandList.add(DefaultLoginAPIAuthenticatorCmd.class);
|
cmdList.add(DefaultLogoutAPIAuthenticatorCmd.class);
|
||||||
s_commandList.add(DefaultLogoutAPIAuthenticatorCmd.class);
|
for (PluggableAPIAuthenticator apiAuthenticator: _apiAuthenticators) {
|
||||||
s_commandList.add(SAML2LoginAPIAuthenticatorCmd.class);
|
cmdList.addAll(apiAuthenticator.getAuthCommands());
|
||||||
s_commandList.add(SAML2LogoutAPIAuthenticatorCmd.class);
|
|
||||||
}
|
}
|
||||||
return s_commandList;
|
return cmdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.api.auth;
|
package com.cloud.api.auth;
|
||||||
|
|
||||||
import com.cloud.api.ApiServerService;
|
import org.apache.cloudstack.api.ApiServerService;
|
||||||
import com.cloud.api.response.ApiResponseSerializer;
|
import com.cloud.api.response.ApiResponseSerializer;
|
||||||
import com.cloud.exception.CloudAuthenticationException;
|
import com.cloud.exception.CloudAuthenticationException;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
@ -26,6 +26,8 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
|||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
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.api.response.LoginCmdResponse;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,8 @@ import org.apache.cloudstack.api.APICommand;
|
|||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
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.cloudstack.api.response.LogoutCmdResponse;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|||||||
@ -16,9 +16,9 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.api;
|
package com.cloud.api;
|
||||||
|
|
||||||
import com.cloud.api.auth.APIAuthenticationManager;
|
import org.apache.cloudstack.api.auth.APIAuthenticationManager;
|
||||||
import com.cloud.api.auth.APIAuthenticationType;
|
import org.apache.cloudstack.api.auth.APIAuthenticationType;
|
||||||
import com.cloud.api.auth.APIAuthenticator;
|
import org.apache.cloudstack.api.auth.APIAuthenticator;
|
||||||
import com.cloud.server.ManagementServer;
|
import com.cloud.server.ManagementServer;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.AccountService;
|
import com.cloud.user.AccountService;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user