Skip to content

Commit 9e53088

Browse files
ajayydvxiaoyuyao
authored andcommitted
Revert "HDDS-1183. Override getDelegationToken API for OzoneFileSystem. Contr…" (#544)
* Revert "Fix checkstyle issue" This reverts commit 78c8a33. * Revert "HDDS-1183. Override getDelegationToken API for OzoneFileSystem. Contributed by Xiaoyu Yao." This reverts commit 6fef6fc.
1 parent 78c8a33 commit 9e53088

File tree

5 files changed

+14
-95
lines changed

5 files changed

+14
-95
lines changed

hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenIdentifier.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.apache.hadoop.io.Text;
2929
import org.apache.hadoop.security.UserGroupInformation;
3030
import org.apache.hadoop.security.token.TokenIdentifier;
31-
import org.apache.hadoop.security.token.Token.TrivialRenewer;
3231

3332
import java.io.DataInput;
3433
import java.io.DataInputStream;
@@ -196,17 +195,5 @@ void writeProtobuf(DataOutput out) throws IOException {
196195
}
197196
out.write(builder.build().toByteArray());
198197
}
199-
200-
/**
201-
* Default TrivialRenewer.
202-
*/
203-
@InterfaceAudience.Private
204-
public static class Renewer extends TrivialRenewer {
205-
206-
@Override
207-
protected Text getKind() {
208-
return KIND_NAME;
209-
}
210-
}
211198
}
212199

hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/OzoneTokenIdentifier.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.hadoop.io.Text;
3030
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMTokenProto;
3131
import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier;
32+
import org.apache.hadoop.security.token.Token;
3233

3334
/**
3435
* The token identifier for Ozone Master.
@@ -67,6 +68,18 @@ public Text getKind() {
6768
return KIND_NAME;
6869
}
6970

71+
/**
72+
* Default TrivialRenewer.
73+
*/
74+
@InterfaceAudience.Private
75+
public static class Renewer extends Token.TrivialRenewer {
76+
77+
@Override
78+
protected Text getKind() {
79+
return KIND_NAME;
80+
}
81+
}
82+
7083
/**
7184
* Overrides default implementation to write using Protobuf.
7285
*

hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientAdapter.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
*/
1818
package org.apache.hadoop.fs.ozone;
1919

20-
import org.apache.hadoop.ozone.security.OzoneTokenIdentifier;
21-
import org.apache.hadoop.security.token.Token;
22-
2320
import java.io.IOException;
2421
import java.io.InputStream;
2522
import java.util.Iterator;
@@ -55,6 +52,4 @@ public interface OzoneClientAdapter {
5552

5653
Iterator<BasicKeyInfo> listKeys(String pathKey);
5754

58-
Token<OzoneTokenIdentifier> getDelegationToken(String renewer)
59-
throws IOException;
6055
}

hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientAdapterImpl.java

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@
2222
import java.util.HashMap;
2323
import java.util.Iterator;
2424

25-
import org.apache.hadoop.classification.InterfaceAudience;
26-
import org.apache.hadoop.conf.Configuration;
2725
import org.apache.hadoop.hdds.client.ReplicationFactor;
2826
import org.apache.hadoop.hdds.client.ReplicationType;
2927
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
30-
import org.apache.hadoop.io.Text;
3128
import org.apache.hadoop.ozone.OzoneConfigKeys;
3229
import org.apache.hadoop.ozone.client.ObjectStore;
3330
import org.apache.hadoop.ozone.client.OzoneBucket;
@@ -38,10 +35,6 @@
3835
import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
3936

4037
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER;
41-
42-
import org.apache.hadoop.ozone.security.OzoneTokenIdentifier;
43-
import org.apache.hadoop.security.token.Token;
44-
import org.apache.hadoop.security.token.TokenRenewer;
4538
import org.slf4j.Logger;
4639
import org.slf4j.LoggerFactory;
4740

@@ -258,64 +251,8 @@ public Iterator<BasicKeyInfo> listKeys(String pathKey) {
258251
return new IteratorAdapter(bucket.listKeys(pathKey));
259252
}
260253

261-
@Override
262-
public Token<OzoneTokenIdentifier> getDelegationToken(String renewer)
263-
throws IOException {
264-
Token<OzoneTokenIdentifier> token =
265-
ozoneClient.getObjectStore().getDelegationToken(new Text(renewer));
266-
token.setKind(OzoneTokenIdentifier.KIND_NAME);
267-
return token;
268-
}
269-
270-
/**
271-
* Ozone Delegation Token Renewer.
272-
*/
273-
@InterfaceAudience.Private
274-
public static class Renewer extends TokenRenewer {
275-
276-
//Ensure that OzoneConfiguration files are loaded before trying to use
277-
// the renewer.
278-
static {
279-
OzoneConfiguration.activate();
280-
}
281-
282-
public Text getKind() {
283-
return OzoneTokenIdentifier.KIND_NAME;
284-
}
285-
286-
@Override
287-
public boolean handleKind(Text kind) {
288-
return getKind().equals(kind);
289-
}
290-
291-
@Override
292-
public boolean isManaged(Token<?> token) throws IOException {
293-
return true;
294-
}
295-
296-
@Override
297-
public long renew(Token<?> token, Configuration conf)
298-
throws IOException, InterruptedException {
299-
Token<OzoneTokenIdentifier> ozoneDt =
300-
(Token<OzoneTokenIdentifier>) token;
301-
OzoneClient ozoneClient =
302-
OzoneClientFactory.getRpcClient(conf);
303-
return ozoneClient.getObjectStore().renewDelegationToken(ozoneDt);
304-
}
305-
306-
@Override
307-
public void cancel(Token<?> token, Configuration conf)
308-
throws IOException, InterruptedException {
309-
Token<OzoneTokenIdentifier> ozoneDt =
310-
(Token<OzoneTokenIdentifier>) token;
311-
OzoneClient ozoneClient =
312-
OzoneClientFactory.getRpcClient(conf);
313-
ozoneClient.getObjectStore().cancelDelegationToken(ozoneDt);
314-
}
315-
}
316-
317254
/**
318-
* Adapter to convert OzoneKey to a safe and simple Key implementation.
255+
* Adapter to conver OzoneKey to a safe and simple Key implementation.
319256
*/
320257
public static class IteratorAdapter implements Iterator<BasicKeyInfo> {
321258

hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneFileSystem.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@
4848
import org.apache.hadoop.fs.GlobalStorageStatistics;
4949
import org.apache.hadoop.fs.permission.FsPermission;
5050
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
51-
import org.apache.hadoop.hdds.security.x509.SecurityConfig;
5251
import org.apache.hadoop.security.UserGroupInformation;
53-
import org.apache.hadoop.security.token.Token;
5452
import org.apache.hadoop.util.Progressable;
5553

5654
import com.google.common.base.Preconditions;
@@ -86,7 +84,6 @@ public class OzoneFileSystem extends FileSystem {
8684
private Path workingDir;
8785

8886
private OzoneClientAdapter adapter;
89-
private boolean securityEnabled;
9087

9188

9289
private OzoneFSStorageStatistics storageStatistics;
@@ -159,10 +156,6 @@ public void initialize(URI name, Configuration conf) throws IOException {
159156
} else {
160157
ozoneConfiguration = new OzoneConfiguration(conf);
161158
}
162-
SecurityConfig secConfig = new SecurityConfig(ozoneConfiguration);
163-
if (secConfig.isSecurityEnabled()) {
164-
this.securityEnabled = true;
165-
}
166159
this.adapter = new OzoneClientAdapterImpl(ozoneConfiguration,
167160
volumeStr, bucketStr, storageStatistics);
168161
}
@@ -676,12 +669,6 @@ public Path getWorkingDirectory() {
676669
return workingDir;
677670
}
678671

679-
@Override
680-
public Token<?> getDelegationToken(String renewer) throws IOException {
681-
return securityEnabled? adapter.getDelegationToken(renewer) :
682-
super.getDelegationToken(renewer);
683-
}
684-
685672
/**
686673
* Get the username of the FS.
687674
*

0 commit comments

Comments
 (0)