本文整理汇总了Java中org.apache.commons.lang3.builder.ReflectionToStringBuilder类的典型用法代码示例。如果您正苦于以下问题:Java ReflectionToStringBuilder类的具体用法?Java ReflectionToStringBuilder怎么用?Java ReflectionToStringBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReflectionToStringBuilder类属于org.apache.commons.lang3.builder包,在下文中一共展示了ReflectionToStringBuilder类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTGT
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; //导入依赖的package包/类
/**
* Get a Ticket Granting Ticket (TGT) from Authentication Server (AS) with required keytab file.
*
* 1. Create and send AS-REQ
* 2. Receive KRB ERROR (PRE-AUTH is mandatory in Kerberos v5)
* 3. Re-send AS-REQ
* 4. Receive AS-REP
* 5. Return TGT credentials ticket in Java object
*
* @param keytabFileName Path file name to keytab (required already on disk storage, for instance
* /etc/bob.keytab)
* @param userName user name principal (UPN) (ex: [email protected])
* @param realm Kerberos domain of the Authentication Server (ex: EXAMPLE.COM)
* @return TGT credentials
* @throws KrbException
* @throws IOException
*
* Note:
* - For system administrator it is like the command: kinit -kt keytab upn
* - [WARNING] dependencies with internal proprietary API and may be removed in a future release
*/
public static Credentials getTGT(String keytabFileName, String userName, String realm)
throws KrbException, IOException {
KrbAsReqBuilder builder = null;
try {
PrincipalName userPrincipalName = new PrincipalName(userName);
KeyTab keyTab = KeyTab.getInstance(new File(keytabFileName));
builder = new KrbAsReqBuilder(userPrincipalName, keyTab);
PrincipalName tgsPrincipalName = PrincipalName.tgsService(realm, realm);
builder.setTarget(tgsPrincipalName);
// see http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/default/src/share/classes/sun/security/krb5/KdcComm.java#l145
// for default parameters (timeout, max retries ...)
builder.action();
Credentials tgtCredentials = builder.getCCreds();
if (DEBUG) {
System.out.println(">>>TGT credentials : " +
ReflectionToStringBuilder.toString(tgtCredentials));
}
return tgtCredentials;
} finally {
if (builder != null) {
builder.destroy();
}
}
}
示例2: toString
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; //导入依赖的package包/类
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
示例3: toString
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; //导入依赖的package包/类
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ourStyle());
}
示例4: toString
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; //导入依赖的package包/类
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
}
示例5: toString
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; //导入依赖的package包/类
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
}
示例6: toString
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; //导入依赖的package包/类
@Override
public String toString() {
return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE)
.toString();
}