Hi Silvano,

Great, thanks for sharing. Sure, we can change this to suit your plugin as 
well. I suggest that you fork ACS on github and share your branch/url with us 
so those of us interested can help you out.

Regards.

On 27-Aug-2014, at 11:29 am, Silvano Nogueira Buback <silv...@corp.globo.com> 
wrote:

> I'm trying use your implementation to implement OAuth2. It's almost
> working, but I think is necessary a little change:
>
> Class APIAuthenticationManagerImpl is calling command without correct
> spring context. I'm working in 4.3 branch, so, I will show what I changed:
>
>
>   - org.apache.cloudstack.api.auth.PluggableAPIAuthenticator needs to
>   implements PluggableService and have no more method getAuthCommands.
>   - Little patch in APIAuthenticationManagerImpl
>
> +++ b/server/src/com/cloud/api/auth/APIAuthenticationManagerImpl.java
> @@ -55,24 +55,31 @@ public class APIAuthenticationManagerImpl extends
> ManagerBase implements APIAuth
>     @Override
>     public boolean start() {
>         s_authenticators = new HashMap<String, Class<?>>();
> -        for (Class<?> authenticator: getCommands()) {
> -            APICommand command =
> authenticator.getAnnotation(APICommand.class);
> -            if (command != null && !command.name().isEmpty()
> -                    &&
> APIAuthenticator.class.isAssignableFrom(authenticator)) {
> -                s_authenticators.put(command.name(), authenticator);
> +        for (Class<?> authenticatorCommand: getCommands()) {
> +            registerCommandsInAPIAuthenticator(authenticatorCommand);
> +        }
> +        // Register all external APIAuthenticator(s)
> +        for (PluggableAPIAuthenticator apiAuthenticator:
> _apiAuthenticators) {
> +            for (Class<?> authenticatorCommand:
> apiAuthenticator.getCommands()) {
> +                registerCommandsInAPIAuthenticator(authenticatorCommand);
>             }
>         }
>         return true;
>     }
>
> +    private void registerCommandsInAPIAuthenticator(Class<?>
> authenticator) {
> +        APICommand command = authenticator.getAnnotation(APICommand.class);
> +        if (command != null && !command.name().isEmpty()
> +                && APIAuthenticator.class.isAssignableFrom(authenticator))
> {
> +            s_authenticators.put(command.name(), authenticator);
> +        }
> +    }
> +
>     @Override
>     public List<Class<?>> getCommands() {
>         List<Class<?>> cmdList = new ArrayList<Class<?>>();
>         cmdList.add(DefaultLoginAPIAuthenticatorCmd.class);
>         cmdList.add(DefaultLogoutAPIAuthenticatorCmd.class);
> -        for (PluggableAPIAuthenticator apiAuthenticator:
> _apiAuthenticators) {
> -            cmdList.addAll(apiAuthenticator.getAuthCommands());
> -        }
>         return cmdList;
>     }
>
>
> Now, authentication commands work inside plugin context.
> PluggableAPIAuthenticator needs to implement tradicional getCommands to
> work.
>
> Best regards,
>
> Silvano Buback
>
>
>
>
> On Tue, Aug 26, 2014 at 6:59 AM, Rohit Yadav <rohit.ya...@shapeblue.com>
> wrote:
>
>>
>> On 26-Aug-2014, at 11:47 am, Sebastien Goasguen <run...@gmail.com> wrote:
>>> we do have some selenium tests in /test/selenium but I don't think they
>> are being run.
>>>
>>> +1 from me (satisfied with your answers)
>>
>> Thanks! Few more classes;
>>
>> Class, %Method, %Line, %
>> GetServiceProviderMetaDataCmd100% (1/ 1)62.5% (5/ 8)77.9% (53/ 68)
>> SAMLMetaDataResponse100% (1/ 1)66.7% (2/ 3)80% (4/ 5)
>>
>> From IntelliJ: http://people.apache.org/~bhaisaab/samlcoverage.png
>>
>> Regards,
>> Rohit Yadav
>> Software Architect, ShapeBlue
>> M. +41 779015219 | rohit.ya...@shapeblue.com
>> Blog: bhaisaab.org | Twitter: @_bhaisaab
>>
>>
>>
>> Find out more about ShapeBlue and our range of CloudStack related services
>>
>> IaaS Cloud Design & Build<
>> http://shapeblue.com/iaas-cloud-design-and-build//>
>> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
>> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
>> CloudStack Infrastructure Support<
>> http://shapeblue.com/cloudstack-infrastructure-support/>
>> CloudStack Bootcamp Training Courses<
>> http://shapeblue.com/cloudstack-training/>
>>
>> This email and any attachments to it may be confidential and are intended
>> solely for the use of the individual to whom it is addressed. Any views or
>> opinions expressed are solely those of the author and do not necessarily
>> represent those of Shape Blue Ltd or related companies. If you are not the
>> intended recipient of this email, you must neither take any action based
>> upon its contents, nor copy or show it to anyone. Please contact the sender
>> if you believe you have received this email in error. Shape Blue Ltd is a
>> company incorporated in England & Wales. ShapeBlue Services India LLP is a
>> company incorporated in India and is operated under license from Shape Blue
>> Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil
>> and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is
>> a company registered by The Republic of South Africa and is traded under
>> license from Shape Blue Ltd. ShapeBlue is a registered trademark.
>>

Regards,
Rohit Yadav
Software Architect, ShapeBlue
M. +41 779015219 | rohit.ya...@shapeblue.com
Blog: bhaisaab.org | Twitter: @_bhaisaab



Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Infrastructure 
Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended 
solely for the use of the individual to whom it is addressed. Any views or 
opinions expressed are solely those of the author and do not necessarily 
represent those of Shape Blue Ltd or related companies. If you are not the 
intended recipient of this email, you must neither take any action based upon 
its contents, nor copy or show it to anyone. Please contact the sender if you 
believe you have received this email in error. Shape Blue Ltd is a company 
incorporated in England & Wales. ShapeBlue Services India LLP is a company 
incorporated in India and is operated under license from Shape Blue Ltd. Shape 
Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is 
operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company 
registered by The Republic of South Africa and is traded under license from 
Shape Blue Ltd. ShapeBlue is a registered trademark.

Reply via email to