本文整理匯總了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();
}