本文整理汇总了Java中net.shibboleth.utilities.java.support.primitive.StringSupport.trimOrNull方法的典型用法代码示例。如果您正苦于以下问题:Java StringSupport.trimOrNull方法的具体用法?Java StringSupport.trimOrNull怎么用?Java StringSupport.trimOrNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.shibboleth.utilities.java.support.primitive.StringSupport
的用法示例。
在下文中一共展示了StringSupport.trimOrNull方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecute
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
final String nameNoTag = StringSupport.trimOrNull(getInputMetadata().getName());
final Map<LangTag, String> map = getInputMetadata().getNameEntries();
if (nameNoTag != null) {
log.debug("{} Found client name without name tag: {}", getLogPrefix(), nameNoTag);
getOutputMetadata().setName(nameNoTag, null);
}
if (map != null && !map.isEmpty()) {
final Iterator<LangTag> tags = map.keySet().iterator();
while (tags.hasNext()) {
final LangTag tag = tags.next();
final String name = StringSupport.trimOrNull(map.get(tag));
if (name != null) {
log.debug("{} Found client name {} for language tag {}", getLogPrefix(), name, tag);
getOutputMetadata().setName(name, tag);
}
}
}
}
示例2: doDecode
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doDecode() throws MessageDecodingException {
final MessageContext<OIDCWebFingerRequest> messageContext = new MessageContext<>();
final HttpServletRequest httpRequest = getHttpServletRequest();
final String resource = StringSupport.trimOrNull(httpRequest.getParameter("resource"));
if (resource == null) {
log.error("No resource parameter value found from the request");
throw new MessageDecodingException("Mandatory value for resource is missing");
}
final String rel = StringSupport.trim(httpRequest.getParameter("rel"));
if (rel == null) {
log.error("No rel parameter value found from the request");
throw new MessageDecodingException("Mandatory value for rel is missing");
}
final OIDCWebFingerRequestImpl request = new OIDCWebFingerRequestImpl(resource, rel);
log.debug("Decoded Web Finger request with resource = {} and rel = {}", resource, rel);
messageContext.setMessage(request);
setMessageContext(messageContext);
}
示例3: populateSubject
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
@Override
protected Subject populateSubject(Subject subject) {
logger.debug("{} TokenValidator populateSubject is called", getLogPrefix());
if (StringSupport.trimOrNull(username) != null) {
logger.debug("{} Populate subject {}", getLogPrefix(), username);
subject.getPrincipals().add(new UsernamePrincipal(username));
return subject;
}
return null;
}
示例4: doExecute
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
@Override
protected void doExecute(@Nonnull final ProfileRequestContext<SAMLObject, SAMLObject> profileRequestContext,
@Nonnull final AuthenticationContext authenticationContext) {
final HttpServletRequest request = getHttpServletRequest();
if (request == null) {
logger.debug("{} Empty HttpServletRequest", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
return;
}
try {
TokenContext tokenCtx = authenticationContext.getSubcontext(TokenContext.class, true);
/** get tokencode from request **/
String value = StringSupport.trimOrNull(request.getParameter(tokenCodeField));
if (Strings.isNullOrEmpty(value)) {
logger.debug("{} Empty tokenCode", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.INVALID_CREDENTIALS);
return;
} else {
logger.debug("{} TokenCode: {}", getLogPrefix(), value);
/** set tokencode to TokenCodeContext **/
tokenCtx.setToken(value);
logger.debug("Put Token code to the TokenCodeCtx");
return;
}
} catch (Exception e) {
logger.warn("{} Login by {} produced exception", getLogPrefix(), e);
}
}
示例5: ProxyGrantingTicket
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
/**
* Creates a proxy-granting ticket with the given values.
*
* @param id Ticket ID.
* @param sessionId IdP session ID used to create ticket.
* @param service Service that requested the ticket.
* @param expiration Expiration instant.
* @param parentId ID of parent proxy-granting ticket or null if this is first proxy in chain.
*/
public ProxyGrantingTicket(
@Nonnull final String id,
@Nonnull final String sessionId,
@Nonnull final String service,
@Nonnull final Instant expiration,
@Nullable final String parentId) {
super(id, sessionId, service, expiration);
this.parentId = StringSupport.trimOrNull(parentId);
}
示例6: setSuffix
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
/**
* Sets the ticket ID suffix.
*
* @param suffix Ticket suffix.
*/
public void setSuffix(@Nullable final String suffix) {
final String s = StringSupport.trimOrNull(suffix);
if (s != null) {
if (!isUrlSafe(s)) {
throw new IllegalArgumentException("Unsupported suffix " + s);
}
this.suffix = s;
}
}
示例7: Service
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
/**
* Creates a new service from given URL and group name.
*
* @param url CAS service URL.
* @param group Group to which service belongs.
* @param proxy True to authorize proxying, false otherwise.
*/
public Service(
@Nonnull @NotEmpty final String url,
@Nullable @NotEmpty final String group,
final boolean proxy) {
this.serviceURL = Constraint.isNotNull(StringSupport.trimOrNull(url), "Service URL cannot be null or empty");
this.group = StringSupport.trimOrNull(group);
this.authorizedToProxy = proxy;
}
示例8: setPgtUrl
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
public void setPgtUrl(@Nonnull final String url) {
this.pgtUrl = StringSupport.trimOrNull(url);
}
示例9: setPgtIou
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
public void setPgtIou(@Nullable final String pgtIou) {
this.pgtIou = StringSupport.trimOrNull(pgtIou);
}
示例10: setScopeDelimiter
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
/**
* Set the scope delimiter.
*
* @param newScopeDelimiter
* delimiter to set
*/
public void setScopeDelimiter(@Nullable final String newScopeDelimiter) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
scopeDelimiter = StringSupport.trimOrNull(newScopeDelimiter);
}
示例11: setGroup
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入方法依赖的package包/类
/**
* Sets the group name.
*
* @param group Group name.
*/
public void setGroup(@NotEmpty final String group) {
this.group = StringSupport.trimOrNull(group);
}