• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java InvalidCredentialsException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.mojang.authlib.exceptions.InvalidCredentialsException的典型用法代码示例。如果您正苦于以下问题:Java InvalidCredentialsException类的具体用法?Java InvalidCredentialsException怎么用?Java InvalidCredentialsException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InvalidCredentialsException类属于com.mojang.authlib.exceptions包,在下文中一共展示了InvalidCredentialsException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: auth

import com.mojang.authlib.exceptions.InvalidCredentialsException; //导入依赖的package包/类
@Override
public AuthResult auth(final String password, boolean force) {
    if (this.userAuthentication.isLoggedIn() && !force) {
        return AuthResult.ALREADY_LOGGED_IN;
    } else {
        this.userAuthentication.logOut();
        this.userAuthentication.setUsername(this.client.getName());
        this.userAuthentication.setPassword(password);

        try {
            this.userAuthentication.logIn();

            this.accessToken = this.userAuthentication.getAuthenticatedToken();
            this.selectedProfile = this.userAuthentication.getSelectedProfile();

            return AuthResult.SUCCESS;
        } catch (UserMigratedException ex) {
            return AuthResult.USER_MIGRATED;
        } catch (InvalidCredentialsException ex2) {
            return AuthResult.INVALID_CREDENTIALS;
        } catch (AuthenticationException ex3) {
            return AuthResult.AUTH_EXCEPTION;
        }
    }
}
 
开发者ID:CaptainBern,项目名称:MinecraftClientLib,代码行数:26,代码来源:Authenticator.java


示例2: handleEncryptionRequest

import com.mojang.authlib.exceptions.InvalidCredentialsException; //导入依赖的package包/类
public void handleEncryptionRequest(S01PacketEncryptionRequest p_147389_1_)
{
    final SecretKey var2 = CryptManager.createNewSharedKey();
    String var3 = p_147389_1_.func_149609_c();
    PublicKey var4 = p_147389_1_.func_149608_d();
    String var5 = (new BigInteger(CryptManager.getServerIdHash(var3, var4, var2))).toString(16);

    try
    {
        this.func_147391_c().joinServer(this.field_147394_b.getSession().func_148256_e(), this.field_147394_b.getSession().getToken(), var5);
    }
    catch (AuthenticationUnavailableException var7)
    {
        this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
        return;
    }
    catch (InvalidCredentialsException var8)
    {
        this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
        return;
    }
    catch (AuthenticationException var9)
    {
        this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {var9.getMessage()}));
        return;
    }

    this.field_147393_d.scheduleOutboundPacket(new C01PacketEncryptionResponse(var2, var4, p_147389_1_.func_149607_e()), new GenericFutureListener[] {new GenericFutureListener()
        {
            private static final String __OBFID = "CL_00000877";
            public void operationComplete(Future p_operationComplete_1_)
            {
                NetHandlerLoginClient.this.field_147393_d.enableEncryption(var2);
            }
        }
    });
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:38,代码来源:NetHandlerLoginClient.java


示例3: handleEncryptionRequest

import com.mojang.authlib.exceptions.InvalidCredentialsException; //导入依赖的package包/类
public void handleEncryptionRequest(S01PacketEncryptionRequest packetIn)
{
    final SecretKey secretkey = CryptManager.createNewSharedKey();
    String s = packetIn.getServerId();
    PublicKey publickey = packetIn.getPublicKey();
    String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);

    if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().func_181041_d())
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationException var10)
        {
            logger.warn("Couldn\'t connect to auth servers but will continue to join LAN");
        }
    }
    else
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationUnavailableException var7)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
        catch (InvalidCredentialsException var8)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
        catch (AuthenticationException authenticationexception)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.networkManager.sendPacket(new C01PacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future <? super Void >> ()
    {
        public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception
        {
            NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey);
        }
    }, new GenericFutureListener[0]);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:50,代码来源:NetHandlerLoginClient.java


示例4: handleEncryptionRequest

import com.mojang.authlib.exceptions.InvalidCredentialsException; //导入依赖的package包/类
public void handleEncryptionRequest(SPacketEncryptionRequest packetIn)
{
    final SecretKey secretkey = CryptManager.createNewSharedKey();
    String s = packetIn.getServerId();
    PublicKey publickey = packetIn.getPublicKey();
    String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);

    if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().isOnLAN())
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationException var10)
        {
            LOGGER.warn("Couldn\'t connect to auth servers but will continue to join LAN");
        }
    }
    else
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationUnavailableException var7)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
        catch (InvalidCredentialsException var8)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
        catch (AuthenticationException authenticationexception)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.networkManager.sendPacket(new CPacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future <? super Void >> ()
    {
        public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception
        {
            NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey);
        }
    }, new GenericFutureListener[0]);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:50,代码来源:NetHandlerLoginClient.java


示例5: handleEncryptionRequest

import com.mojang.authlib.exceptions.InvalidCredentialsException; //导入依赖的package包/类
public void handleEncryptionRequest(S01PacketEncryptionRequest p_147389_1_)
{
    final SecretKey secretkey = CryptManager.createNewSharedKey();
    String s = p_147389_1_.func_149609_c();
    PublicKey publickey = p_147389_1_.func_149608_d();
    String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
    boolean flag = this.field_147394_b.func_147104_D() == null || !this.field_147394_b.func_147104_D().func_152585_d();

    try
    {
        this.func_147391_c().joinServer(this.field_147394_b.getSession().func_148256_e(), this.field_147394_b.getSession().getToken(), s1);
    }
    catch (AuthenticationUnavailableException authenticationunavailableexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
    }
    catch (InvalidCredentialsException invalidcredentialsexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
    }
    catch (AuthenticationException authenticationexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.field_147393_d.scheduleOutboundPacket(new C01PacketEncryptionResponse(secretkey, publickey, p_147389_1_.func_149607_e()), new GenericFutureListener[] {new GenericFutureListener()
    {
        private static final String __OBFID = "CL_00000877";
        public void operationComplete(Future p_operationComplete_1_)
        {
            NetHandlerLoginClient.this.field_147393_d.enableEncryption(secretkey);
        }
    }
                                                                                                                                            });
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:48,代码来源:NetHandlerLoginClient.java



注:本文中的com.mojang.authlib.exceptions.InvalidCredentialsException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Pattern类代码示例发布时间:2022-05-22
下一篇:
Java NSObject类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap