@Override
        public GetDelegationTokenResponse getDelegationToken(GetDelegationTokenRequest request) throws IOException {

            UserGroupInformation ugi = UserGroupInformation.getCurrentUser();

            // Verify that the connection is kerberos authenticated
            if (!isAllowedDelegationTokenOp()) {
                throw new IOException("Delegation Token can be issued only with kerberos authentication");
            }

            GetDelegationTokenResponse response = recordFactory.newRecordInstance(GetDelegationTokenResponse.class);

            String user = ugi.getUserName();
            Text owner = new Text(user);
            Text realUser = null;
            if (ugi.getRealUser() != null) {
                realUser = new Text(ugi.getRealUser().getUserName());
            }
            MRDelegationTokenIdentifier tokenIdentifier =
                    new MRDelegationTokenIdentifier(owner, new Text(request.getRenewer()), realUser);
            Token<MRDelegationTokenIdentifier> realJHSToken =
                    new Token<MRDelegationTokenIdentifier>(tokenIdentifier, jhsDTSecretManager);
            org.apache.hadoop.yarn.api.records.Token mrDToken = org.apache.hadoop.yarn.api.records.Token.newInstance(
                    realJHSToken.getIdentifier(), realJHSToken.getKind().toString(),
                    realJHSToken.getPassword(), realJHSToken.getService().toString());
            response.setDelegationToken(mrDToken);
            return response;
        }
This module is responsible for talking to the
JobClient (user facing).
history-server/src/main/java/net/qihoo/hbox/jobhistory/HistoryClientService.java