本文整理汇总了Java中net.shibboleth.utilities.java.support.primitive.StringSupport类的典型用法代码示例。如果您正苦于以下问题:Java StringSupport类的具体用法?Java StringSupport怎么用?Java StringSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringSupport类属于net.shibboleth.utilities.java.support.primitive包,在下文中一共展示了StringSupport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: init
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入依赖的package包/类
@Override
public void init(final FilterConfig config) throws ServletException {
String param = config.getInitParameter(LEAF_HEADERS_PARAM);
if (param != null) {
leafHeader = param;
}
log.info("ProxyX509Filter will check for the leaf certificate in: {}", leafHeader);
param = config.getInitParameter(CHAIN_HEADERS_PARAM);
if (param != null) {
final String[] headers = param.split(" ");
if (headers != null) {
chainHeaders = StringSupport.normalizeStringCollection(Arrays.asList(headers));
}
}
log.info("ProxyX509Filter will check for chain certificates in: {}", chainHeaders);
}
示例4: doParse
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
@Nonnull final BeanDefinitionBuilder builder) {
super.doParse(config, parserContext, builder);
if (config.hasAttributeNS(null, AS_ARRAY_ATTRIBUTE_NAME)) {
builder.addPropertyValue("asArray",
StringSupport.trimOrNull(config.getAttributeNS(null, AS_ARRAY_ATTRIBUTE_NAME)));
}
if (config.hasAttributeNS(null, AS_INT_ATTRIBUTE_NAME)) {
builder.addPropertyValue("asInt",
StringSupport.trimOrNull(config.getAttributeNS(null, AS_INT_ATTRIBUTE_NAME)));
}
if (config.hasAttributeNS(null, STRING_DELIMETER_ATTRIBUTE_NAME)) {
builder.addPropertyValue("stringDelimiter",
StringSupport.trimOrNull(config.getAttributeNS(null, STRING_DELIMETER_ATTRIBUTE_NAME)));
}
if (config.hasAttributeNS(null, AS_OBJECT_ATTRIBUTE_NAME)) {
builder.addPropertyValue("asObject",
StringSupport.trimOrNull(config.getAttributeNS(null, AS_OBJECT_ATTRIBUTE_NAME)));
}
if (config.hasAttributeNS(null, FIELD_NAME_ATTRIBUTE_NAME)) {
builder.addPropertyValue("fieldName",
StringSupport.trimOrNull(config.getAttributeNS(null, FIELD_NAME_ATTRIBUTE_NAME)));
}
if (config.hasAttributeNS(null, AS_BOOLEAN_ATTRIBUTE_NAME)) {
builder.addPropertyValue("asBoolean",
StringSupport.trimOrNull(config.getAttributeNS(null, AS_BOOLEAN_ATTRIBUTE_NAME)));
}
}
示例5: doParse
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
@Nonnull final BeanDefinitionBuilder builder) {
super.doParse(config, parserContext, builder);
if (config.hasAttributeNS(null, SCOPE_DELIMETER_ATTRIBUTE_NAME)) {
builder.addPropertyValue("scopeDelimiter",
StringSupport.trimOrNull(config.getAttributeNS(null, SCOPE_DELIMETER_ATTRIBUTE_NAME)));
}
}
示例6: doNativeParse
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doNativeParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
@Nonnull final BeanDefinitionBuilder builder) {
super.doParse(config, builder);
if (config.hasAttributeNS(null, "onlyIfEssential")) {
builder.addPropertyValue("onlyIfEssential",
StringSupport.trimOrNull(config.getAttributeNS(null, "onlyIfEssential")));
}
if (config.hasAttributeNS(null, "matchOnlyIDToken")) {
builder.addPropertyValue("matchOnlyIDToken",
StringSupport.trimOrNull(config.getAttributeNS(null, "matchOnlyIDToken")));
}
if (config.hasAttributeNS(null, "matchOnlyUserInfo")) {
builder.addPropertyValue("matchOnlyUserInfo",
StringSupport.trimOrNull(config.getAttributeNS(null, "matchOnlyUserInfo")));
}
if (config.hasAttributeNS(null, "matchIfRequestedClaimsSilent")) {
builder.addPropertyValue("matchIfRequestedClaimsSilent",
StringSupport.trimOrNull(config.getAttributeNS(null, "matchIfRequestedClaimsSilent")));
}
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:29,代码来源:AttributeInOIDCRequestedClaimsRuleParser.java
示例7: 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;
}
示例8: 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);
}
}
示例9: doExecute
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext,
@Nonnull final ProfileInterceptorContext interceptorContext) {
final ConsentContext consentContext = getConsentContext();
final HttpServletRequest request = getHttpServletRequest();
if (request == null) {
log.debug("{} Profile action does not contain an HttpServletRequest", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
return;
}
final String[] consentIdsRequestParameterValues = request.getParameterValues(CONSENT_IDS_REQUEST_PARAMETER);
if (consentIdsRequestParameterValues == null) {
log.debug("{} No consent choices available from user input", getLogPrefix());
return;
}
final Collection<String> consentIds =
StringSupport.normalizeStringCollection(Arrays.asList(consentIdsRequestParameterValues));
log.debug("{} Extracted consent ids '{}' from request parameter '{}'", getLogPrefix(), consentIds,
CONSENT_IDS_REQUEST_PARAMETER);
final Map<String, Consent> currentConsents = getConsentContext().getCurrentConsents();
for (final Consent consent : currentConsents.values()) {
if (consentIds.contains(consent.getId())) {
consent.setApproved(Boolean.TRUE);
} else {
consent.setApproved(Boolean.FALSE);
}
}
log.debug("{} Consent context '{}'", getLogPrefix(), consentContext);
}
示例10: 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);
}
示例11: TicketIdentifierGenerationStrategy
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入依赖的package包/类
/**
* Creates a new ticket ID generator.
*
* @param randomLength Length in characters of random part of the ticket.
* @param prefix Ticket ID prefix (e.g. ST, PT, PGT). MUST be a URL safe string.
*/
public TicketIdentifierGenerationStrategy(
@Positive final int randomLength,
@Nonnull @NotEmpty final String prefix) {
if (randomLength < 1) {
throw new IllegalArgumentException("Length of random part of ticket must be positive");
}
this.randomPartGenerator = new RandomIdGenerator(randomLength);
this.prefix = Constraint.isNotNull(StringSupport.trimOrNull(prefix), "Prefix cannot be null or empty");
if (!isUrlSafe(this.prefix)) {
throw new IllegalArgumentException("Unsupported prefix " + this.prefix);
}
}
示例12: 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;
}
}
示例13: CASSPSession
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入依赖的package包/类
/**
* Creates a new CAS SP session.
*
* @param id the identifier of the service associated with this session
* @param creation creation time of session, in milliseconds since the epoch
* @param expiration expiration time of session, in milliseconds since the epoch
* @param ticketId ticket ID used to gain access to the service
*/
public CASSPSession(
@Nonnull @NotEmpty String id,
@Duration @Positive long creation,
@Duration @Positive long expiration,
@Nonnull @NotEmpty String ticketId) {
super(id, creation, expiration);
this.ticketId = Constraint.isNotNull(StringSupport.trimOrNull(ticketId), "Ticket ID cannot be null or empty");
}
示例14: 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;
}
示例15: setAuthenticationFlows
import net.shibboleth.utilities.java.support.primitive.StringSupport; //导入依赖的package包/类
/**
* Set the authentication flows to use.
*
* @param flows flow identifiers to use
*/
public void setAuthenticationFlows(@Nonnull @NonnullElements final Collection<String> flows) {
Constraint.isNotNull(flows, "Collection of flows cannot be null");
authenticationFlows = new HashSet<>(StringSupport.normalizeStringCollection(flows));
}