Implementing custom plugin

classic Classic list List threaded Threaded
13 messages Options
vitalys vitalys
Reply | Threaded
Open this post in threaded view
|

Implementing custom plugin

Hi,

I am trying to implement a custom plugin. I followed an instructions in
Ignite tutorial and added a property to the default-config.xml configuration
file :

 <property name="pluginConfigurations">
              <bean class="com.plugins.SecurityPluginConfiguration"/>
</property>

Then I implemented "SecurityPluginConfiguration" :

public class SecurityPluginConfiguration implements PluginConfiguration {
               
    public Class<? extends SecurityPluginProvider> providerClass() {
        return SecurityPluginProvider.class;
    }
}

and "SecurityPluginProvider" :

public class SecurityPluginProvider  implements
PluginProvider<SecurityPluginConfiguration>{


        @Override
    public String name() {
                System.out.println("%%%% Plugin Name : WhiteListSecurity %%%%%%");
        return "WhiteListSecurity";
    }
       
        @Override
    public String version() {
        return "1.0.0";
    }

        @Override
        public void start(PluginContext arg0) throws IgniteCheckedException {
                // TODO Auto-generated method stub
                System.out.println(" %%%%%%  Starting Security Plugin Provider %%%%%%% ");
               
        }
       
         @Nullable
         @Override
         public Object createComponent(PluginContext ctx, Class cls) {
                 
                 System.out.println(" %%%%%%  Create Component HERE!!! %%%%%%% ");
                if (cls.isAssignableFrom(GridSecurityProcessor.class)) {
                    return new WhiteListSecurityProcessor();
                } else {
                    return null;
                }
         }
.....

// other methods
}

When I am starting Ignite Node I don't see anything in the log file what I
am trying to print out. It seems that "
start() or onIgniteStart() methods are not being invoked.

Do I miss anything? Is there any clear example of plugin implementation?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Alexey Kuznetsov-2 Alexey Kuznetsov-2
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

Hi!

As far as I know, you need create a file "src/main/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider"
with full class name of your plugin.

Hope this helps.

--
Alexey Kuznetsov
vitalys vitalys
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

That worked, thank you. Now I am getting :

java.util.ServiceConfigurationError:
org.apache.ignite.plugin.PluginProvider: Pr
ovider com.plugins.SecurityPluginConfiguration not a subtype



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Ruslan Kamashev Ruslan Kamashev
Reply | Threaded
Open this post in threaded view
|

Wrong backup size with persistence + data expriation

Hi,

I try to use data expiration with persistence, but I got wrong backup size after cache records are expired.
Also sometimes I got result when expired records didn't deleted but I can't reproduce this case again.

Could you share more details about using data expiration with persistence?

Source: https://github.com/rynffoll/ignite-tests
Logs: https://github.com/rynffoll/ignite-tests/tree/master/logs/persistance_with_data_expiration

ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

In reply to this post by vitalys
Hello!

I guess you also have to implement IgnitePlugin.

Regards,
--
Ilya Kasnacheev


пт, 8 февр. 2019 г. в 20:59, vitalys <[hidden email]>:
That worked, thank you. Now I am getting :

java.util.ServiceConfigurationError:
org.apache.ignite.plugin.PluginProvider: Pr
ovider com.plugins.SecurityPluginConfiguration not a subtype



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
vitalys vitalys
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

I already implement IgnitePlugin. I am following an example from :

http://smartkey.co.uk/development/securing-an-apache-ignite-cluster/


public class WhiteListSecurityProcessor
implements DiscoverySpiNodeAuthenticator,          
           *IgnitePlugin *{

        @Override
        public SecurityContext authenticateNode(ClusterNode arg0,
SecurityCredentials arg1) throws IgniteException {
                // TODO Auto-generated method stub
                return null;
        }

        @Override
        public boolean isGlobalNodeAuthentication() {
                // TODO Auto-generated method stub
                return false;
        }

.....







--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Sergio Hernández Martínez Sergio Hernández Martínez
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

Sorry, but this custom plugin only has authentication section for node and you can check permisions for nodes.

The authorize method always has null security context.

Thanks!

From: vitalys <[hidden email]>
Sent: Wednesday, February 13, 2019 5:32:01 PM
To: [hidden email]
Subject: Re: Implementing custom plugin
 
I already implement IgnitePlugin. I am following an example from :

http://smartkey.co.uk/development/securing-an-apache-ignite-cluster/


public class WhiteListSecurityProcessor
implements DiscoverySpiNodeAuthenticator,          
           *IgnitePlugin *{

        @Override
        public SecurityContext authenticateNode(ClusterNode arg0,
SecurityCredentials arg1) throws IgniteException {
                // TODO Auto-generated method stub
                return null;
        }

        @Override
        public boolean isGlobalNodeAuthentication() {
                // TODO Auto-generated method stub
                return false;
        }

.....







--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
vitalys vitalys
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

The problem is it's not working at all. I am getting this error :

Corporation Java HotSpot(TM) 64-Bit Server VM 25.171-b11
java.util.ServiceConfigurationError:
org.apache.ignite.plugin.PluginProvider:
Provider com.plugins.SecurityPluginConfiguration not a subtype

I have no idea what that means and how to address it. Am I missing something
in configuration? Should I implement some additional concrete class or
particular interface?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

Hello!

Can you share a sample reproducer project on GitHub?

Regards,
--
Ilya Kasnacheev


чт, 14 февр. 2019 г. в 00:28, vitalys <[hidden email]>:
The problem is it's not working at all. I am getting this error :

Corporation Java HotSpot(TM) 64-Bit Server VM 25.171-b11
java.util.ServiceConfigurationError:
org.apache.ignite.plugin.PluginProvider:
Provider com.plugins.SecurityPluginConfiguration not a subtype

I have no idea what that means and how to address it. Am I missing something
in configuration? Should I implement some additional concrete class or
particular interface?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
vitalys vitalys
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

Unfortunately I can't due to the security restrictions in the office. I have
posted all the elements of the project in the previous posts and it's very
much a replication of an example outlined at :

http://smartkey.co.uk/development/securing-an-apache-ignite-cluster/
<http://smartkey.co.uk/development/securing-an-apache-ignite-cluster/>  

It  would be very beneficial if I there you direct me to the working example
of the plugin. Any plugin for that matter.

At this point I am not sure if it's a configuration issue or some kind of
limitation on behave of Apache Ignite v.2.5

thank you.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

Hello!

Ignite tests contain at least four plugins so you can just checkout Ignite source (ignite-2.5 branch if desired), copy any test plugin to your sources and try to make it work.

Regards,
--
Ilya Kasnacheev


чт, 14 февр. 2019 г. в 19:15, vitalys <[hidden email]>:
Unfortunately I can't due to the security restrictions in the office. I have
posted all the elements of the project in the previous posts and it's very
much a replication of an example outlined at :

http://smartkey.co.uk/development/securing-an-apache-ignite-cluster/
<http://smartkey.co.uk/development/securing-an-apache-ignite-cluster/

It  would be very beneficial if I there you direct me to the working example
of the plugin. Any plugin for that matter.

At this point I am not sure if it's a configuration issue or some kind of
limitation on behave of Apache Ignite v.2.5

thank you.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
vitalys vitalys
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin

Is it on GitHub, what branch? I checked there but couldn't find anything.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom plugin


вс, 17 февр. 2019 г. в 22:58, vitalys <[hidden email]>:
Is it on GitHub, what branch? I checked there but couldn't find anything.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/