本文整理匯總了Java中org.pac4j.core.credentials.extractor.BasicAuthExtractor類的典型用法代碼示例。如果您正苦於以下問題:Java BasicAuthExtractor類的具體用法?Java BasicAuthExtractor怎麽用?Java BasicAuthExtractor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BasicAuthExtractor類屬於org.pac4j.core.credentials.extractor包,在下文中一共展示了BasicAuthExtractor類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: constructCredentialsFromRequest
import org.pac4j.core.credentials.extractor.BasicAuthExtractor; //導入依賴的package包/類
@Override
protected Credential constructCredentialsFromRequest(final RequestContext requestContext) {
try {
final HttpServletRequest request = WebUtils.getHttpServletRequest(requestContext);
final HttpServletResponse response = WebUtils.getHttpServletResponse(requestContext);
final BasicAuthExtractor extractor = new BasicAuthExtractor(this.getClass().getSimpleName());
final WebContext webContext = WebUtils.getPac4jJ2EContext(request, response);
final UsernamePasswordCredentials credentials = extractor.extract(webContext);
if (credentials != null) {
LOGGER.debug("Received basic authentication request from credentials [{}]", credentials);
return new UsernamePasswordCredential(credentials.getUsername(), credentials.getPassword());
}
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
示例2: extractBasicAuthenticationCredential
import org.pac4j.core.credentials.extractor.BasicAuthExtractor; //導入依賴的package包/類
private Credential extractBasicAuthenticationCredential(final HttpServletRequest request,
final HttpServletResponse response) {
try {
final BasicAuthExtractor extractor = new BasicAuthExtractor(this.getClass().getSimpleName());
final WebContext webContext = WebUtils.getPac4jJ2EContext(request, response);
final UsernamePasswordCredentials credentials = extractor.extract(webContext);
if (credentials != null) {
LOGGER.debug("Received basic authentication ECP request from credentials [{}]", credentials);
return new UsernamePasswordCredential(credentials.getUsername(), credentials.getPassword());
}
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
示例3: internalInit
import org.pac4j.core.credentials.extractor.BasicAuthExtractor; //導入依賴的package包/類
@Override
protected void internalInit(final WebContext context) {
super.internalInit(context);
CommonHelper.assertNotBlank("realmName", this.realmName);
setRedirectActionBuilder(webContext -> RedirectAction.redirect(computeFinalCallbackUrl(webContext)));
setCredentialsExtractor(new BasicAuthExtractor(getName()));
}
示例4: internalInit
import org.pac4j.core.credentials.extractor.BasicAuthExtractor; //導入依賴的package包/類
@Override
protected void internalInit(final WebContext context) {
CommonHelper.assertNotBlank("headerName", this.headerName);
CommonHelper.assertNotNull("prefixHeader", this.prefixHeader);
setCredentialsExtractor(new BasicAuthExtractor(this.headerName, this.prefixHeader, getName()));
if (CommonHelper.isNotBlank(this.casServerPrefixUrl)) {
setAuthenticator(new CasRestAuthenticator(this.casServerPrefixUrl));
}
}
示例5: clientInit
import org.pac4j.core.credentials.extractor.BasicAuthExtractor; //導入依賴的package包/類
protected void clientInit(WebContext context) {
this.defaultCredentialsExtractor(new BasicAuthExtractor(this.getName()));
}
示例6: internalInit
import org.pac4j.core.credentials.extractor.BasicAuthExtractor; //導入依賴的package包/類
@Override
protected void internalInit(final WebContext context) {
setCredentialsExtractor(new BasicAuthExtractor(getName()));
}