当前位置: 首页>>代码示例>>Java>>正文


Java AuthorizationData.count方法代码示例

本文整理汇总了Java中sun.security.krb5.internal.AuthorizationData.count方法的典型用法代码示例。如果您正苦于以下问题:Java AuthorizationData.count方法的具体用法?Java AuthorizationData.count怎么用?Java AuthorizationData.count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.security.krb5.internal.AuthorizationData的用法示例。


在下文中一共展示了AuthorizationData.count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: inquireSecContext

import sun.security.krb5.internal.AuthorizationData; //导入方法依赖的package包/类
@Override
public Object inquireSecContext(InquireType type) throws GSSException {
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkPermission(
                new InquireSecContextPermission(type.toString()));
    }
    Object output = super.inquireSecContext(type.name());
    if (output != null) {
        if (type == InquireType.KRB5_GET_AUTHZ_DATA) {
            AuthorizationData ad = (AuthorizationData) output;
            AuthorizationDataEntry[] authzData =
                    new AuthorizationDataEntry[ad.count()];
            for (int i = 0; i < ad.count(); i++) {
                authzData[i] = new AuthorizationDataEntry(
                        ad.item(i).adType, ad.item(i).adData);
            }
            output = authzData;
        }
    }
    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:ExtendedGSSContextImpl.java

示例2: decodeAuthorizationData

import sun.security.krb5.internal.AuthorizationData; //导入方法依赖的package包/类
private Map<String, Object> decodeAuthorizationData(AuthorizationData authorizationData) throws Exception{
	Map<String, Object> clientDetailsFromPac = new HashMap<String, Object>();
	//Iterate through the authorizationData and find adData with adType = AD-IF-RELEVANT (1) - see RFC 4210 section 7.5.4
	for( int i = 0; i < authorizationData.count(); i++) {
		if (authorizationData.item(i).adType == 1){
			DerInputStream adDataStream = new DerInputStream(authorizationData.item(i).adData);
			DerValue[] values = adDataStream.getSet(authorizationData.item(i).adData.length, true);
			//values[0] contains authorizationData entry with adType = AD-WIN2k-PAC (128) - see RFC 4210 section 7.5.4
			DerValue pacDerValue = values[0];
			AuthorizationDataEntry pacAuthorizationDataEntry = new AuthorizationDataEntry(pacDerValue);
			if (pacAuthorizationDataEntry.adType != 128){
				throw new IOException("PAC not found within authorization data as expected. Was expecting adType=128 (AD-WIN2K-PAC) within AD-IF-RELEVANT");
			}
			Pac pac = new Pac(pacAuthorizationDataEntry.adData, this.serverPrivateKey);
			clientDetailsFromPac.put("pac", pac);
			clientDetailsFromPac.put("fullName", pac.getFullName());
			clientDetailsFromPac.put("groupMemberships", pac.getGroupMemberships());
			clientDetailsFromPac.put("homeDirectory", pac.getHomeDirectory());
			clientDetailsFromPac.put("groupCount", pac.getiGroupCount());
			clientDetailsFromPac.put("kdc", pac.getKdc());
			clientDetailsFromPac.put("logonCount", pac.getLogonCount());
			clientDetailsFromPac.put("logonDomainName", pac.getLogonDomainName());
			clientDetailsFromPac.put("passwordExpiryDateTime", pac.getPasswordExpiresDateTime());
			clientDetailsFromPac.put("passwordSetDateTime", pac.getPasswordSetDateTime());
			clientDetailsFromPac.put("primaryGroup", pac.getPrimaryGroup());
			clientDetailsFromPac.put("profilePath", pac.getProfilePath());
		}
	}
	return clientDetailsFromPac;
}
 
开发者ID:jcmturner,项目名称:java-kerberos-utils,代码行数:31,代码来源:Krb5ServerHelper.java


注:本文中的sun.security.krb5.internal.AuthorizationData.count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。