Skip to content

Commit

Permalink
#gg-9809: authenticateNode return SecurityContext.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasilinets committed Feb 18, 2015
1 parent 4756e14 commit 0c8c2eb
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Expand Up @@ -238,7 +238,7 @@ public void setNodeAttributes(Map<String, Object> attrs, IgniteProductVersion ve
getSpi().setMetricsProvider(createMetricsProvider()); getSpi().setMetricsProvider(createMetricsProvider());


getSpi().setAuthenticator(new DiscoverySpiNodeAuthenticator() { getSpi().setAuthenticator(new DiscoverySpiNodeAuthenticator() {
@Override public GridSecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials cred) { @Override public SecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials cred) {
try { try {
return ctx.security().authenticateNode(node, cred); return ctx.security().authenticateNode(node, cred);
} }
Expand Down
Expand Up @@ -35,7 +35,7 @@ public interface DiscoverySpiNodeAuthenticator {
* @throws IgniteException If authentication process failed * @throws IgniteException If authentication process failed
* (invalid credentials should not lead to this exception). * (invalid credentials should not lead to this exception).
*/ */
public GridSecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials cred) throws IgniteException; public SecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials cred) throws IgniteException;


/** /**
* Gets global node authentication flag. * Gets global node authentication flag.
Expand Down
Expand Up @@ -1271,7 +1271,7 @@ private void joinTopology() throws IgniteSpiException {


// Authenticate local node. // Authenticate local node.
try { try {
GridSecurityContext subj = nodeAuth.authenticateNode(locNode, locCred); SecurityContext subj = nodeAuth.authenticateNode(locNode, locCred);


if (subj == null) if (subj == null)
throw new IgniteSpiException("Authentication failed for local node: " + locNode.id()); throw new IgniteSpiException("Authentication failed for local node: " + locNode.id());
Expand Down Expand Up @@ -3066,7 +3066,7 @@ private void processJoinRequestMessage(TcpDiscoveryJoinRequestMessage msg) {
try { try {
GridSecurityCredentials cred = unmarshalCredentials(node); GridSecurityCredentials cred = unmarshalCredentials(node);


GridSecurityContext subj = nodeAuth.authenticateNode(node, cred); SecurityContext subj = nodeAuth.authenticateNode(node, cred);


if (subj == null) { if (subj == null) {
// Node has not pass authentication. // Node has not pass authentication.
Expand Down Expand Up @@ -3510,7 +3510,7 @@ private void processNodeAddedMessage(TcpDiscoveryNodeAddedMessage msg) {
authFailed = false; authFailed = false;
} }
else { else {
GridSecurityContext subj = nodeAuth.authenticateNode(node, cred); SecurityContext subj = nodeAuth.authenticateNode(node, cred);


GridSecurityContext coordSubj = ignite.configuration().getMarshaller().unmarshal( GridSecurityContext coordSubj = ignite.configuration().getMarshaller().unmarshal(
node.<byte[]>attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT), U.gridClassLoader()); node.<byte[]>attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT), U.gridClassLoader());
Expand Down
Expand Up @@ -390,7 +390,7 @@ protected long getMaxMetricsWaitTime() {
}); });


spi.setAuthenticator(new DiscoverySpiNodeAuthenticator() { spi.setAuthenticator(new DiscoverySpiNodeAuthenticator() {
@Override public GridSecurityContext authenticateNode(ClusterNode n, GridSecurityCredentials cred) { @Override public SecurityContext authenticateNode(ClusterNode n, GridSecurityCredentials cred) {
GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE, n.id()); GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE, n.id());


return new GridSecurityContext(subj); return new GridSecurityContext(subj);
Expand Down
Expand Up @@ -65,7 +65,7 @@ public DiscoverySpiDataExchange getDataExchange() {
@GridSpiTestConfig @GridSpiTestConfig
public DiscoverySpiNodeAuthenticator getAuthenticator() { public DiscoverySpiNodeAuthenticator getAuthenticator() {
return new DiscoverySpiNodeAuthenticator() { return new DiscoverySpiNodeAuthenticator() {
@Override public GridSecurityContext authenticateNode(ClusterNode n, GridSecurityCredentials cred) { @Override public SecurityContext authenticateNode(ClusterNode n, GridSecurityCredentials cred) {
GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE, n.id()); GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE, n.id());


return new GridSecurityContext(subj); return new GridSecurityContext(subj);
Expand Down
Expand Up @@ -333,7 +333,7 @@ private void configureDiscovery(GridSpiTest spiTest) throws Exception {
getTestResources().inject(discoSpi); getTestResources().inject(discoSpi);


discoSpi.setAuthenticator(new DiscoverySpiNodeAuthenticator() { discoSpi.setAuthenticator(new DiscoverySpiNodeAuthenticator() {
@Override public GridSecurityContext authenticateNode(ClusterNode n, GridSecurityCredentials cred) { @Override public SecurityContext authenticateNode(ClusterNode n, GridSecurityCredentials cred) {
GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE, n.id()); GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE, n.id());


return new GridSecurityContext(subj); return new GridSecurityContext(subj);
Expand Down

0 comments on commit 0c8c2eb

Please sign in to comment.