热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

jcifs.smb.NtlmPasswordAuthentication类的使用及代码示例

本文整理了Java中jcifs.smb.NtlmPasswordAuthentication类的一些代码示例,展示了NtlmPasswordAuthenti

本文整理了Java中jcifs.smb.NtlmPasswordAuthentication类的一些代码示例,展示了NtlmPasswordAuthentication类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NtlmPasswordAuthentication类的具体详情如下:
包路径:jcifs.smb.NtlmPasswordAuthentication
类名称:NtlmPasswordAuthentication

NtlmPasswordAuthentication介绍

[英]This class stores and encrypts NTLM user credentials. The default credentials are retrieved from the jcifs.smb.client.domain, jcifs.smb.client.username, and jcifs.smb.client.password properties.

Read jCIFS Exceptions and NtlmAuthenticator for related information.
[中]此类存储并加密NTLM用户凭据。从jcifs检索默认凭据。中小企业。客户域名,jcifs。中小企业。客户用户名和Ifs。中小企业。客户密码属性。
有关信息,请阅读{$0$}。

代码示例

代码示例来源:origin: stackoverflow.com

String user = "your_user_name";
String pass ="your_pass_word";
String sharedFolder="shared";
String path="smb://ip_address/"+sharedFolder+"/test.txt";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("",user, pass);
SmbFile smbFile = new SmbFile(path,auth);
SmbFileOutputStream smbfos = new SmbFileOutputStream(smbFile);
smbfos.write("testing....and writing to a file".getBytes());
System.out.println("completed ...nice !");

代码示例来源:origin: jcifs/jcifs

defaultDomain;
user = (index != -1) ? user.substring(index + 1) : user;
ntlm = new NtlmPasswordAuthentication(domain, user, password);
ssn.setAttribute( "ntlmdomain", ntlm.getDomain() );
ssn.setAttribute( "ntlmuser", ntlm.getUsername() );
} else {
HttpSession ssn = request.getSession(false);

代码示例来源:origin: jcifs/jcifs

defaultDomain;
user = (index != -1) ? user.substring(index + 1) : user;
ntlm = new NtlmPasswordAuthentication(domain, user, password);
dc = UniAddress.getByName( domainController, true );
log.println( "NtlmHttpFilter: " + ntlm.getName() +
": 0x" + jcifs.util.Hexdump.toHexString( sae.getNtStatus(), 8 ) +
": " + sae );

代码示例来源:origin: org.jinterop/j-interopdeps

byte[] ntResponse;
try {
ntRespOnse= Responses.getNTLM2SessionResponse(credentials.getPassword(), challenge, clientNonce);
} catch (Exception e)
credentials.getDomain(), credentials.getUsername(),
Type3Message.getDefaultWorkstation());
NTLMKeyFactory ntlmKeyFactory = new NTLMKeyFactory();
byte[] sessionResponseUserSessionKey;
try {
sessiOnResponseUserSessionKey= ntlmKeyFactory.getNTLM2SessionResponseUserSessionKey(credentials.getPassword(), servernonce);
byte[] lmRespOnse= NtlmPasswordAuthentication.getPreNTLMResponse(
credentials.getPassword(), challenge);
byte[] ntRespOnse= NtlmPasswordAuthentication.getNTLMResponse(
credentials.getPassword(), challenge);
type3 = new Type3Message(flags, lmResponse, ntResponse,
credentials.getDomain(), credentials.getUsername(),
Type3Message.getDefaultWorkstation());
if ((flags & NtlmFlags.NTLMSSP_NEGOTIATE_KEY_EXCH) != 0) {

代码示例来源:origin: org.codelibs/jcifs

String domain = ( index != -1 ) ? user.substring(0, index) : this.defaultDomain;
user = ( index != -1 ) ? user.substring(index + 1) : user;
ntlm = new NtlmPasswordAuthentication(getTransportContext(), domain, user, password);
ssn.setAttribute("ntlmdomain", ntlm.getUserDomain());
ssn.setAttribute("ntlmuser", ntlm.getUsername());

代码示例来源:origin: org.samba.jcifs/jcifs

public byte[] initSecContext(byte[] token, int offset, int len) throws SmbException {
switch (state) {
case 1:
Type1Message msg1 = new Type1Message(ntlmsspFlags, auth.getDomain(), workstation);
token = msg1.toByteArray();
auth.getPassword(),
auth.getDomain(),
auth.getUsername(),
workstation,
ntlmsspFlags);

代码示例来源:origin: org.codelibs/jcifs

@Override
public NtlmPasswordAuthentication clone () {
NtlmPasswordAuthentication clOned= new NtlmPasswordAuthentication();
cloneInternal(cloned, this);
return cloned;
}

代码示例来源:origin: jcifs/jcifs

/**
* Computes the 24 byte ANSI password hash given the 8 byte server challenge.
*/
public byte[] getAnsiHash( byte[] challenge ) {
if( hashesExternal ) {
return ansiHash;
}
switch (LM_COMPATIBILITY) {
case 0:
case 1:
return getPreNTLMResponse( password, challenge );
case 2:
return getNTLMResponse( password, challenge );
case 3:
case 4:
case 5:
if( clientChallenge == null ) {
clientChallenge = new byte[8];
RANDOM.nextBytes( clientChallenge );
}
return getLMv2Response(domain, username, password, challenge,
clientChallenge);
default:
return getPreNTLMResponse( password, challenge );
}
}
/**

代码示例来源:origin: org.codelibs/jcifs

String domain = npa.getUserDomain();
String user = !npa.isAnonymous() ? npa.getUsername() : null;
String password = npa.getPassword();
String userInfo = this.url.getUserInfo();
if ( userInfo != null ) {

代码示例来源:origin: jcifs/jcifs

capabilities &= ~SmbConstants.CAP_EXTENDED_SECURITY;
} else if (session.transport.server.encryptedPasswords) {
lmHash = auth.getAnsiHash( session.transport.server.encryptionKey );
ntHash = auth.getUnicodeHash( session.transport.server.encryptionKey );
} else if( useUnicode ) {
String password = auth.getPassword();
lmHash = new byte[0];
ntHash = new byte[(password.length() + 1) * 2];
} else {
String password = auth.getPassword();
lmHash = new byte[(password.length() + 1) * 2];
ntHash = new byte[0];

代码示例来源:origin: net.dataforte.doorkeeper/doorkeeper-core

log.debug("NtlmHttpFilter: " + ntlm.getName() + ": 0x" + Hexdump.toHexString(sae.getNtStatus(), 8) + ": ", sae);
log.error("", e);
return new AuthenticatorToken(ntlm.getUsername());

代码示例来源:origin: jcifs/jcifs

/**
* Return the domain and username in the format:
* domain\\username. This is equivalent to getName().
*/
public String toString() {
return getName();
}

代码示例来源:origin: jcifs/jcifs

/**
* Computes the 24 byte Unicode password hash given the 8 byte server challenge.
*/
public byte[] getUnicodeHash( byte[] challenge ) {
if( hashesExternal ) {
return unicodeHash;
}
switch (LM_COMPATIBILITY) {
case 0:
case 1:
case 2:
return getNTLMResponse( password, challenge );
case 3:
case 4:
case 5:
/*
if( clientChallenge == null ) {
clientChallenge = new byte[8];
RANDOM.nextBytes( clientChallenge );
}
return getNTLMv2Response(domain, username, password, null,
challenge, clientChallenge);
*/
return new byte[0];
default:
return getNTLMResponse( password, challenge );
}
}

代码示例来源:origin: org.openscada.jinterop/org.openscada.jinterop.deps

public Type1Message createType1 () throws IOException
{
final int flags = getDefaultFlags ();
return new Type1Message ( flags, this.credentials.getDomain (), Type1Message.getDefaultWorkstation () );
}

代码示例来源:origin: org.jinterop/j-interopdeps

System.arraycopy(type3Message.getLMResponse(), 0, servernonce, 8, 8);//first 8 bytes only , the rest are all 0x00 and not required.
try {
sessiOnResponseUserSessionKey= ntlmKeyFactory.getNTLM2SessionResponseUserSessionKey(credentials.getPassword(), servernonce);
} catch (Exception e) {
throw new RuntimeException("Exception occured while forming Session Security from Type3 AUTH",e);

代码示例来源:origin: jcifs/jcifs

/**
* Constructs the LanManager response to the given Type-2 message using
* the supplied password.
*
* @param type2 The Type-2 message.
* @param password The password.
* @return A byte[] containing the LanManager response.
*/
public static byte[] getLMResponse(Type2Message type2, String password) {
if (type2 == null || password == null) return null;
return NtlmPasswordAuthentication.getPreNTLMResponse(password,
type2.getChallenge());
}

代码示例来源:origin: com.jaeksoft/jcifs-krb5-jdk7

defaultDomain;
user = (index != -1) ? user.substring(index + 1) : user;
ntlm = new NtlmPasswordAuthentication(domain, user, password);
ssn.setAttribute( "ntlmdomain", ntlm.getDomain() );
ssn.setAttribute( "ntlmuser", ntlm.getUsername() );
} else {
HttpSession ssn = request.getSession(false);

代码示例来源:origin: com.jaeksoft/jcifs-krb5-jdk7

defaultDomain;
user = (index != -1) ? user.substring(index + 1) : user;
ntlm = new NtlmPasswordAuthentication(domain, user, password);
dc = UniAddress.getByName( domainController, true );
log.println( "NtlmHttpFilter: " + ntlm.getName() +
": 0x" + jcifs.util.Hexdump.toHexString( sae.getNtStatus(), 8 ) +
": " + sae );

代码示例来源:origin: org.openscada.jinterop/org.openscada.jinterop.deps

target = this.credentials.getDomain ().toUpperCase ();
if ( target.equals ( "" ) )
try
final byte[] lmv2RespOnse= Responses.getLMv2Response ( target, this.credentials.getUsername (), this.credentials.getPassword (), type2.getChallenge (), clientNonce );
final byte[][] retval = Responses.getNTLMv2Response ( target, this.credentials.getUsername (), this.credentials.getPassword (), type2.getTargetInformation (), type2.getChallenge (), clientNonce );
final byte[] ntlmv2RespOnse= retval[0];
blob = retval[1];
type3 = new Type3Message ( flags, lmv2Response, ntlmv2Response, target, this.credentials.getUsername (), Type3Message.getDefaultWorkstation () );
try
ntRespOnse= Responses.getNTLM2SessionResponse ( this.credentials.getPassword (), challenge, clientNonce );
type3 = new Type3Message ( flags, lmResponse, ntResponse, target, this.credentials.getUsername (), Type3Message.getDefaultWorkstation () );
final byte[] lmRespOnse= NtlmPasswordAuthentication.getPreNTLMResponse ( this.credentials.getPassword (), challenge );
final byte[] ntRespOnse= NtlmPasswordAuthentication.getNTLMResponse ( this.credentials.getPassword (), challenge );
type3 = new Type3Message ( flags, lmResponse, ntResponse, target, this.credentials.getUsername (), Type3Message.getDefaultWorkstation () );
if ( ( flags & NtlmFlags.NTLMSSP_NEGOTIATE_KEY_EXCH ) != 0 )
userSessiOnKey= ntlmKeyFactory.getNTLMv2UserSessionKey ( target, this.credentials.getUsername (), this.credentials.getPassword (), type2.getChallenge (), blob );
try
userSessiOnKey= ntlmKeyFactory.getNTLM2SessionResponseUserSessionKey ( this.credentials.getPassword (), servernonce );

代码示例来源:origin: AgNO3/jcifs-ng

String domain = ( index != -1 ) ? user.substring(0, index) : this.defaultDomain;
user = ( index != -1 ) ? user.substring(index + 1) : user;
ntlm = new NtlmPasswordAuthentication(getTransportContext(), domain, user, password);
ssn.setAttribute("ntlmdomain", ntlm.getUserDomain());
ssn.setAttribute("ntlmuser", ntlm.getUsername());

推荐阅读
author-avatar
绿林VS逍遥
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有