@POST @Path("/delegation-token/expiration") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public Response postDelegationTokenExpiration(@Context HttpServletRequest hsr) throws AuthorizationException, IOException, InterruptedException, Exception { init(); UserGroupInformation callerUGI; try { callerUGI = createKerberosUserGroupInformation(hsr); } catch (YarnException ye) { return Response.status(Status.FORBIDDEN).entity(ye.getMessage()).build(); } DelegationToken requestToken = new DelegationToken(); requestToken.setToken(extractToken(hsr).encodeToUrlString()); return renewDelegationToken(requestToken, hsr, callerUGI); }
@POST @Path("/delegation-token/expiration") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public Response postDelegationTokenExpiration(@Context HttpServletRequest hsr) throws AuthorizationException, IOException, InterruptedException, Exception { init(); UserGroupInformation callerUGI; try { callerUGI = createKerberosUserGroupInformation(hsr); } catch (YarnException ye) { return Response.status(Status.FORBIDDEN).entity(ye.getMessage()).build(); } DelegationToken requestToken = new DelegationToken(); requestToken.setToken(extractToken(hsr).encodeToUrlString()); return renewDelegationToken(requestToken, hsr, callerUGI); }
@POST @Path(RMWSConsts.DELEGATION_TOKEN_EXPIRATION) @Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 }) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Override public Response postDelegationTokenExpiration(@Context HttpServletRequest hsr) throws AuthorizationException, IOException, InterruptedException, Exception { UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true); initForWritableEndpoints(callerUGI, false); try { createKerberosUserGroupInformation(hsr, callerUGI); callerUGI.setAuthenticationMethod(AuthenticationMethod.KERBEROS); } catch (YarnException ye) { return Response.status(Status.FORBIDDEN).entity(ye.getMessage()).build(); } DelegationToken requestToken = new DelegationToken(); requestToken.setToken(extractToken(hsr).encodeToUrlString()); return renewDelegationToken(requestToken, hsr, callerUGI); }
DelegationToken respToken = new DelegationToken(); respToken.setNextExpirationTime(renewTime); return Response.status(Status.OK).entity(respToken).build();
DelegationToken respToken = new DelegationToken(); respToken.setNextExpirationTime(renewTime); return Response.status(Status.OK).entity(respToken).build();
DelegationToken respToken = new DelegationToken(); respToken.setNextExpirationTime(renewTime); return Response.status(Status.OK).entity(respToken).build();
long currentExpiration = rm.getRMContext() .getRMDelegationTokenSecretManager().getRenewDate(identifier); DelegationToken respToken = new DelegationToken(tk.encodeToUrlString(), renewer, identifier.getOwner().toString(), tk.getKind().toString(), currentExpiration, identifier.getMaxDate());
.getRenewDate(identifier); DelegationToken respToken = new DelegationToken(tk.encodeToUrlString(), renewer, identifier .getOwner().toString(), tk.getKind().toString(), currentExpiration, identifier.getMaxDate());
.getRenewDate(identifier); DelegationToken respToken = new DelegationToken(tk.encodeToUrlString(), renewer, identifier .getOwner().toString(), tk.getKind().toString(), currentExpiration, identifier.getMaxDate());
public static DelegationToken getDelegationTokenFromXML(String tokenXML) throws IOException, ParserConfigurationException, SAXException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(tokenXML)); Document dom = db.parse(is); NodeList nodes = dom.getElementsByTagName("delegation-token"); assertEquals("incorrect number of elements", 1, nodes.getLength()); Element element = (Element) nodes.item(0); DelegationToken ret = new DelegationToken(); String token = WebServicesTestUtils.getXmlString(element, "token"); if (token != null) { ret.setToken(token); } else { long expiration = WebServicesTestUtils.getXmlLong(element, "expiration-time"); ret.setNextExpirationTime(expiration); } return ret; }
public static DelegationToken getDelegationTokenFromXML(String tokenXML) throws IOException, ParserConfigurationException, SAXException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(tokenXML)); Document dom = db.parse(is); NodeList nodes = dom.getElementsByTagName("delegation-token"); assertEquals("incorrect number of elements", 1, nodes.getLength()); Element element = (Element) nodes.item(0); DelegationToken ret = new DelegationToken(); String token = WebServicesTestUtils.getXmlString(element, "token"); if (token != null) { ret.setToken(token); } else { long expiration = WebServicesTestUtils.getXmlLong(element, "expiration-time"); ret.setNextExpirationTime(expiration); } return ret; }
public static DelegationToken getDelegationTokenFromJson(JSONObject json) throws JSONException { DelegationToken ret = new DelegationToken(); if (json.has("token")) { ret.setToken(json.getString("token")); } else if (json.has("expiration-time")) { ret.setNextExpirationTime(json.getLong("expiration-time")); } return ret; }
public static DelegationToken getDelegationTokenFromJson(JSONObject json) throws JSONException { DelegationToken ret = new DelegationToken(); if (json.has("token")) { ret.setToken(json.getString("token")); } else if (json.has("expiration-time")) { ret.setNextExpirationTime(json.getLong("expiration-time")); } return ret; }
final DelegationToken dtoken = new DelegationToken(); String renewer = "client2"; dtoken.setRenewer(renewer);
final DelegationToken dtoken = new DelegationToken(); String renewer = "client2"; dtoken.setRenewer(renewer);
@Override public Void call() throws Exception { ClientResponse response = resource().path("ws").path("v1").path("cluster") .path("delegation-token").accept(contentType) .entity(body, mediaType).post(ClientResponse.class); assertResponseStatusCode(Status.OK, response.getStatusInfo()); DelegationToken tok = getDelegationTokenFromResponse(response); assertFalse(tok.getToken().isEmpty()); Token<RMDelegationTokenIdentifier> token = new Token<RMDelegationTokenIdentifier>(); token.decodeFromUrlString(tok.getToken()); assertEquals(renewer, token.decodeIdentifier().getRenewer().toString()); assertValidRMToken(tok.getToken()); DelegationToken dtoken = new DelegationToken(); response = resource().path("ws").path("v1").path("cluster") .path("delegation-token").accept(contentType) .entity(dtoken, mediaType).post(ClientResponse.class); assertResponseStatusCode(Status.OK, response.getStatusInfo()); tok = getDelegationTokenFromResponse(response); assertFalse(tok.getToken().isEmpty()); token = new Token<RMDelegationTokenIdentifier>(); token.decodeFromUrlString(tok.getToken()); assertEquals("", token.decodeIdentifier().getRenewer().toString()); assertValidRMToken(tok.getToken()); return null; } });
@Override public Void call() throws Exception { ClientResponse response = resource().path("ws").path("v1").path("cluster") .path("delegation-token").accept(contentType) .entity(body, mediaType).post(ClientResponse.class); assertEquals(Status.OK, response.getClientResponseStatus()); DelegationToken tok = getDelegationTokenFromResponse(response); assertFalse(tok.getToken().isEmpty()); Token<RMDelegationTokenIdentifier> token = new Token<RMDelegationTokenIdentifier>(); token.decodeFromUrlString(tok.getToken()); assertEquals(renewer, token.decodeIdentifier().getRenewer().toString()); assertValidRMToken(tok.getToken()); DelegationToken dtoken = new DelegationToken(); response = resource().path("ws").path("v1").path("cluster") .path("delegation-token").accept(contentType) .entity(dtoken, mediaType).post(ClientResponse.class); assertEquals(Status.OK, response.getClientResponseStatus()); tok = getDelegationTokenFromResponse(response); assertFalse(tok.getToken().isEmpty()); token = new Token<RMDelegationTokenIdentifier>(); token.decodeFromUrlString(tok.getToken()); assertEquals("", token.decodeIdentifier().getRenewer().toString()); assertValidRMToken(tok.getToken()); return null; } });
final DelegationToken dtoken = new DelegationToken(); String renewer = "client2"; dtoken.setRenewer(renewer);
final DelegationToken dtoken = new DelegationToken(); String renewer = "client2"; dtoken.setRenewer(renewer);
final String renewer = "client2"; this.client().addFilter(new LoggingFilter(System.out)); final DelegationToken dummyToken = new DelegationToken(); dummyToken.setRenewer(renewer); String[] mediaTypes =