Hi,
       I have implemented the grid security processor and setting the
securityconext holder in the authenticate function as below,

public class MySecurityProcessor extends GridProcessorAdapter implements
DiscoverySpiNodeAuthenticator, GridSecurityProcessor, IgnitePlugin {

................
public SecurityContext authenticate(AuthenticationContext
authenticationContext) throws IgniteCheckedException {
       SecuritySubject secureSecuritySubject = new SecuritySubject(
            authenticationContext.subjectId(),
            authenticationContext.subjectType(),
            authenticationContext.credentials().getLogin(),
            authenticationContext.address()
    );
    SecurityContext securityContext = new
MySecurityContext(secureSecuritySubject, accessToken);
    SecurityContextHolder.set(securityContext);
    return securityContext;
}
public void authorize(String name, SecurityPermission perm, SecurityContext
securityCtx) throws SecurityException {
    System.out.println(   SecurityContextHolder.get());
    System.out.println( securityCtx );
    //do some authorization
     .....................
}
......
}

In plugin provider i am creating the component : GridSecurityProcessor.

The server starts  without throwing any error, also plugin provider also
starts.
Questions:
1. When i start the visor , it is able to connect to ignite server. If i
execute some commands in visor like: top , cache,etc, authorize function is
getting called and always gives the  security context as NULL. How do i get
the securitycontext?  . Also when visor is called authenticate function is
not getting called.
2. When rest api call is made to create a cache why the authroize function
is getting called twice? one my GridRestProcessor and GridCacheProcessor?
In this scenario: secuirty context i am getting from
SecurityContextHolder.get(). So no issues.

regards
Radha

Reply via email to