Skip to content

Commit

Permalink
#ignite-189: GridSecurityManager from GridManager to GridProcessor.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasilinets committed Feb 10, 2015
1 parent 4e60207 commit d42453e
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 34 deletions.
Expand Up @@ -394,14 +394,14 @@ public interface GridKernalContext extends Iterable<GridComponent> {
* *
* @return Authentication manager. * @return Authentication manager.
*/ */
public GridSecurityManager security(); public GridSecurityProcessor security();


/** /**
* Gets secure session manager. * Gets secure session manager.
* *
* @return Secure session manager. * @return Secure session manager.
*/ */
public GridSecureSessionManager secureSession(); public GridSecureSessionProcessor secureSession();


/** /**
* Gets load balancing manager. * Gets load balancing manager.
Expand Down
Expand Up @@ -127,11 +127,11 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable


/** */ /** */
@GridToStringExclude @GridToStringExclude
private GridSecurityManager authMgr; private GridSecurityProcessor authProc;


/** */ /** */
@GridToStringExclude @GridToStringExclude
private GridSecureSessionManager sesMgr; private GridSecureSessionProcessor sesMgr;


/** */ /** */
@GridToStringExclude @GridToStringExclude
Expand Down Expand Up @@ -416,10 +416,10 @@ else if (comp instanceof GridFailoverManager)
failoverMgr = (GridFailoverManager)comp; failoverMgr = (GridFailoverManager)comp;
else if (comp instanceof GridCollisionManager) else if (comp instanceof GridCollisionManager)
colMgr = (GridCollisionManager)comp; colMgr = (GridCollisionManager)comp;
else if (comp instanceof GridSecurityManager) else if (comp instanceof GridSecurityProcessor)
authMgr = (GridSecurityManager)comp; authProc = (GridSecurityProcessor)comp;
else if (comp instanceof GridSecureSessionManager) else if (comp instanceof GridSecureSessionProcessor)
sesMgr = (GridSecureSessionManager)comp; sesMgr = (GridSecureSessionProcessor)comp;
else if (comp instanceof GridLoadBalancerManager) else if (comp instanceof GridLoadBalancerManager)
loadMgr = (GridLoadBalancerManager)comp; loadMgr = (GridLoadBalancerManager)comp;
else if (comp instanceof GridSwapSpaceManager) else if (comp instanceof GridSwapSpaceManager)
Expand Down Expand Up @@ -652,12 +652,12 @@ public void addHelper(Object helper) {
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public GridSecurityManager security() { @Override public GridSecurityProcessor security() {
return authMgr; return authProc;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public GridSecureSessionManager secureSession() { @Override public GridSecureSessionProcessor secureSession() {
return sesMgr; return sesMgr;
} }


Expand Down
Expand Up @@ -725,8 +725,9 @@ public void start(final IgniteConfiguration cfg, ExecutorService utilityCachePoo


// Start SPI managers. // Start SPI managers.
// NOTE: that order matters as there are dependencies between managers. // NOTE: that order matters as there are dependencies between managers.
startManager(ctx, createComponent(GridSecurityManager.class, ctx), attrs); startProcessor(ctx, createComponent(GridSecurityProcessor.class, ctx), attrs);
startManager(ctx, createComponent(GridSecureSessionManager.class, ctx), attrs); startProcessor(ctx, createComponent(GridSecureSessionProcessor.class, ctx), attrs);

startManager(ctx, new GridIoManager(ctx), attrs); startManager(ctx, new GridIoManager(ctx), attrs);
startManager(ctx, new GridCheckpointManager(ctx), attrs); startManager(ctx, new GridCheckpointManager(ctx), attrs);


Expand Down
Expand Up @@ -20,6 +20,7 @@
import org.apache.ignite.*; import org.apache.ignite.*;
import org.apache.ignite.cluster.*; import org.apache.ignite.cluster.*;
import org.apache.ignite.internal.*; import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.*;
import org.apache.ignite.spi.*; import org.apache.ignite.spi.*;
import org.jetbrains.annotations.*; import org.jetbrains.annotations.*;


Expand All @@ -28,7 +29,7 @@
/** /**
* No-op {@link GridManager} adapter. * No-op {@link GridManager} adapter.
*/ */
public class GridNoopManagerAdapter implements GridManager { public class GridNoopManagerAdapter implements GridProcessor {
/** /**
* @param ctx Kernal context. * @param ctx Kernal context.
*/ */
Expand All @@ -37,15 +38,10 @@ public GridNoopManagerAdapter(GridKernalContext ctx) {
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public void addSpiAttributes(Map<String, Object> attrs) throws IgniteCheckedException { @Override public void addAttributes(Map<String, Object> attrs) throws IgniteCheckedException {
// No-op. // No-op.
} }


/** {@inheritDoc} */
@Override public boolean enabled() {
return false;
}

/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public void start() throws IgniteCheckedException { @Override public void start() throws IgniteCheckedException {
// No-op. // No-op.
Expand Down
Expand Up @@ -18,8 +18,8 @@
package org.apache.ignite.internal.managers.securesession; package org.apache.ignite.internal.managers.securesession;


import org.apache.ignite.*; import org.apache.ignite.*;
import org.apache.ignite.internal.managers.*;
import org.apache.ignite.internal.managers.security.*; import org.apache.ignite.internal.managers.security.*;
import org.apache.ignite.internal.processors.*;
import org.apache.ignite.plugin.security.*; import org.apache.ignite.plugin.security.*;
import org.jetbrains.annotations.*; import org.jetbrains.annotations.*;


Expand All @@ -28,7 +28,7 @@
/** /**
* This interface defines a grid secure session manager. * This interface defines a grid secure session manager.
*/ */
public interface GridSecureSessionManager extends GridManager { public interface GridSecureSessionProcessor extends GridProcessor {
/** /**
* @param subjType Subject type. * @param subjType Subject type.
* @param subjId Subject ID. * @param subjId Subject ID.
Expand All @@ -51,4 +51,10 @@ public GridSecureSession validateSession(GridSecuritySubjectType subjType, UUID
*/ */
public byte[] updateSession(GridSecuritySubjectType subjType, UUID subjId, GridSecurityContext subjCtx, public byte[] updateSession(GridSecuritySubjectType subjType, UUID subjId, GridSecurityContext subjCtx,
@Nullable Object params) throws IgniteCheckedException; @Nullable Object params) throws IgniteCheckedException;

/**
* @return Returns {@code true} if at least one SPI does not have a {@code NO-OP}
* implementation, {@code false} otherwise.
*/
public boolean enabled();
} }
Expand Up @@ -28,16 +28,16 @@
import java.util.*; import java.util.*;


/** /**
* No-op implementation for {@link GridSecureSessionManager}. * No-op implementation for {@link org.apache.ignite.internal.managers.securesession.GridSecureSessionProcessor}.
*/ */
public class GridOsSecureSessionManager extends GridNoopManagerAdapter implements GridSecureSessionManager { public class GridOsSecureSessionProcessor extends GridNoopManagerAdapter implements GridSecureSessionProcessor {
/** Empty bytes. */ /** Empty bytes. */
private static final byte[] EMPTY_BYTES = new byte[0]; private static final byte[] EMPTY_BYTES = new byte[0];


/** /**
* @param ctx Kernal context. * @param ctx Kernal context.
*/ */
public GridOsSecureSessionManager(GridKernalContext ctx) { public GridOsSecureSessionProcessor(GridKernalContext ctx) {
super(ctx); super(ctx);
} }


Expand All @@ -53,4 +53,9 @@ public GridOsSecureSessionManager(GridKernalContext ctx) {
@Nullable Object params) { @Nullable Object params) {
return EMPTY_BYTES; return EMPTY_BYTES;
} }

/** {@inheritDoc} */
@Override public boolean enabled() {
return false;
}
} }
Expand Up @@ -33,7 +33,7 @@ public class GridSecurityImpl implements GridSecurity, Externalizable {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;


/** Security manager. */ /** Security manager. */
private GridSecurityManager secMgr; private GridSecurityProcessor secProc;


/** Context. */ /** Context. */
private GridKernalContext ctx; private GridKernalContext ctx;
Expand All @@ -49,14 +49,14 @@ public GridSecurityImpl() {
* @param ctx Context. * @param ctx Context.
*/ */
public GridSecurityImpl(GridKernalContext ctx) { public GridSecurityImpl(GridKernalContext ctx) {
this.secMgr = ctx.security(); this.secProc = ctx.security();
this.ctx = ctx; this.ctx = ctx;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public Collection<GridSecuritySubject> authenticatedSubjects() throws IgniteException { @Override public Collection<GridSecuritySubject> authenticatedSubjects() throws IgniteException {
try { try {
return secMgr.authenticatedSubjects(); return secProc.authenticatedSubjects();
} }
catch (IgniteCheckedException e) { catch (IgniteCheckedException e) {
throw U.convertException(e); throw U.convertException(e);
Expand All @@ -66,7 +66,7 @@ public GridSecurityImpl(GridKernalContext ctx) {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public GridSecuritySubject authenticatedSubject(UUID subjId) throws IgniteException { @Override public GridSecuritySubject authenticatedSubject(UUID subjId) throws IgniteException {
try { try {
return secMgr.authenticatedSubject(subjId); return secProc.authenticatedSubject(subjId);
} }
catch (IgniteCheckedException e) { catch (IgniteCheckedException e) {
throw U.convertException(e); throw U.convertException(e);
Expand Down
Expand Up @@ -19,7 +19,7 @@


import org.apache.ignite.*; import org.apache.ignite.*;
import org.apache.ignite.cluster.*; import org.apache.ignite.cluster.*;
import org.apache.ignite.internal.managers.*; import org.apache.ignite.internal.processors.*;
import org.apache.ignite.plugin.security.*; import org.apache.ignite.plugin.security.*;
import org.apache.ignite.spi.authentication.*; import org.apache.ignite.spi.authentication.*;
import org.jetbrains.annotations.*; import org.jetbrains.annotations.*;
Expand All @@ -29,7 +29,7 @@
/** /**
* This interface defines a grid authentication manager. * This interface defines a grid authentication manager.
*/ */
public interface GridSecurityManager extends GridManager { public interface GridSecurityProcessor extends GridProcessor {
/** /**
* Authenticates grid node with it's attributes via underlying {@link org.apache.ignite.spi.authentication.AuthenticationSpi}s. * Authenticates grid node with it's attributes via underlying {@link org.apache.ignite.spi.authentication.AuthenticationSpi}s.
* *
Expand Down Expand Up @@ -90,4 +90,10 @@ public void authorize(String name, GridSecurityPermission perm, @Nullable GridSe
* @param subjId Subject ID. * @param subjId Subject ID.
*/ */
public void onSessionExpired(UUID subjId); public void onSessionExpired(UUID subjId);

/**
* @return Returns {@code true} if at least one SPI does not have a {@code NO-OP}
* implementation, {@code false} otherwise.
*/
public boolean enabled();
} }
Expand Up @@ -31,13 +31,13 @@
import java.util.*; import java.util.*;


/** /**
* No-op implementation for {@link GridSecurityManager}. * No-op implementation for {@link GridSecurityProcessor}.
*/ */
public class GridOsSecurityManager extends GridNoopManagerAdapter implements GridSecurityManager { public class GridOsSecurityProcessor extends GridNoopManagerAdapter implements GridSecurityProcessor {
/** /**
* @param ctx Kernal context. * @param ctx Kernal context.
*/ */
public GridOsSecurityManager(GridKernalContext ctx) { public GridOsSecurityProcessor(GridKernalContext ctx) {
super(ctx); super(ctx);
} }


Expand Down Expand Up @@ -94,4 +94,9 @@ public GridOsSecurityManager(GridKernalContext ctx) {
@Override public void onSessionExpired(UUID subjId) { @Override public void onSessionExpired(UUID subjId) {
// No-op. // No-op.
} }

/** {@inheritDoc} */
@Override public boolean enabled() {
return false;
}
} }

0 comments on commit d42453e

Please sign in to comment.