是否等效于Java中的"gss_import_name"和"gss_init_sec_context"方法? [英] Equivalent of 'gss_import_name' and 'gss_init_sec_context' methods in java?

查看:397
本文介绍了是否等效于Java中的"gss_import_name"和"gss_init_sec_context"方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个小型应用程序(目前),该应用程序需要使用Kerberos库生成令牌.我正在搜索的两个等效方法是 gss_import_name gss_init_sec_context 方法.我发现了几种其他语言的示例:C,C ++和C#,但Java中没有.我什至不确定要在应用程序中导入哪个库.如果有人回答了我的问题,那对我会非常有帮助.

I'm creating a small application(for now) that needs to generate a Token with Kerberos library. The two methods equivalent I'm searching for are the gss_import_name and gss_init_sec_context methods. I have found several examples in other languages: C,C++ and C#, but none in Java. I'm not even sure of which library to import in my application. If someone has an answer to my question it would be very helpful to me.

Ephismen,顺便说一句.

Cordially, Ephismen.

推荐答案

您要使用的软件包是sun.security.jgss.在该软件包中,您可以执行以下操作:

The package you want to use is sun.security.jgss. In that package you will find you can do the following:

byte[] kerberosTicket;

GSSContext context = GSSManager.getInstance().createContext((GSSCredential);
context.initSecContext(kerberosTicket, 0, kerberosTicket.length);
String user = context.getSrcName().toString();
context.dispose();
return user;

GSSContext的唯一实现是GSSContextImpl,它也位于同一程序包中.

The only implementation of GSSContext is GSSContextImpl which is also in the same package.

赠予

这篇关于是否等效于Java中的"gss_import_name"和"gss_init_sec_context"方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆