GridGain Developers Hub
GitHub logo GridGain iso
GridGain Software Documentation

Passcode Authentication

PasscodeAuthenticator provides authentication and authorization through Access Control List (ACL). ACL maps security credentials to a set of permissions that will be assigned to authenticated subjects. Permissions for nodes and clients should be provided in JSON format.

Here is an example of how PasscodeAuthenticator can be configured programmatically:

// Provide security credentials.
SecurityCredentials serverCreds = new SecurityCredentials("server", "password");
SecurityCredentials clientCreds = new SecurityCredentials("client", "password");

// GridGain plugin configuration.
GridGainConfiguration cfg = new GridGainConfiguration();

PasscodeAuthenticator authenticator = new PasscodeAuthenticator();

// Create map for node and client with their security credentials and permissions.
Map<SecurityCredentials, String> authMap = new HashMap<>();

// Allow all operations on server nodes.
authMap.put(serverCreds, "{defaultAllow:true}");

// Allow only cache reads on client nodes.
authMap.put(clientCreds, "{defaultAllow:false, {cache:'*', permissions:['CACHE_READ']}}");

authenticator.setAclProvider(new AuthenticationAclBasicProvider(authMap));

cfg.setSecurityCredentialsProvider(new SecurityCredentialsBasicProvider(serverCreds));

or via a Spring XML configuration file:

<bean class="" id="server.cred">
    <constructor-arg value="server"/>
    <constructor-arg value="password"/>

<!-- Client node credentials. -->
<bean class="" id="client.cred">
    <constructor-arg value="client"/>
    <constructor-arg value="password"/>

<bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
    <property name="pluginConfigurations">
        <bean class="org.gridgain.grid.configuration.GridGainConfiguration">
            <property name="authenticator">
                <bean class="">
                    <property name="aclProvider">
                        <bean class="">
                                    <!-- Allow all operations on server nodes. -->
                                    <entry key-ref="server.cred" value="{defaultAllow:true}"/>
                                    <!-- Allow only cache reads on client nodes. -->
                                    <entry key-ref="client.cred" value="{defaultAllow:false, {cache:'*',permissions:['CACHE_READ']}}"/>
            <property name="securityCredentialsProvider">
                <bean class="">
                    <!-- Specify credentials for the current node -->
                    <constructor-arg ref="server.cred"/>