有没有更合适的方法来分析的AuthenticationException的错误code? [英] Is there a neater way to analyse the AuthenticationException for the error code?

查看:612
本文介绍了有没有更合适的方法来分析的AuthenticationException的错误code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有更合适的方法来检查 javax.naming.AuthenticationException (或弹簧)为主要不合格原因是什么?不同的错误desciribed在 LDAP维基(绑定错误)

本的AuthenticationException没有提供足够的API,以确定容易出错code。唯一的内容就是异常消息。

  [LDAP:错误code 49  -  80090308:
 LdapErr:DSID-0C090334,
 评论:AcceptSecurityContext错误,数据773,vece]
 

该identifing块是数据773 - 站立误差 ERROR_PASSWORD_MUST_CHANGE 。但感觉很奇怪,我去检查 message.contains(数据773)!有没有更好的方法来检查错误code?


这引发片段的的AuthenticationException 写的 org.springframework.security.ldap.DefaultSpringSecurityContextSource

  InitialLdapContext上下文=(InitialLdapContext)contextFactory
                     .getReadWriteContext(本金,密码);
 

解决方案

不幸的是,这是唯一的办法,我已经看到了处理,因为失败codeS所生产的LDAP服务,我有(Active Directory)的经验,总是EN codeS失败code在邮件中。不要感到太糟糕,即使它不是一个很好的方式做事情。

Is there a neater way to check the javax.naming.AuthenticationException (or spring) for the main failure reason? The different errors are desciribed in LDAP Wiki (Binding Errors).

The AuthenticationException provides no sufficient API to determine easily the error code. The only content is the exception message.

[LDAP: error code 49 - 80090308: 
 LdapErr: DSID-0C090334, 
 comment: AcceptSecurityContext error, data 773, vece]

The identifing block is the "data 773" – standing for the error ERROR_PASSWORD_MUST_CHANGE. But it feels very odd to me to check for message.contains("data 773")! Is there any better way to check the error code?


The snippet which throws the AuthenticationException is written with the org.springframework.security.ldap.DefaultSpringSecurityContextSource.

InitialLdapContext context = (InitialLdapContext) contextFactory
                     .getReadWriteContext(principal, password);

解决方案

Unfortunately this is the only way I've seen it handled because the failure codes produced by the LDAP service I have experience with (Active Directory) always encodes the failure code in the message. Don't feel too bad even though it isn't a nice way to do things.

这篇关于有没有更合适的方法来分析的AuthenticationException的错误code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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