当前位置: 首页>>代码示例>>Java>>正文


Java BasicAuthClient类代码示例

本文整理汇总了Java中org.pac4j.http.client.BasicAuthClient的典型用法代码示例。如果您正苦于以下问题:Java BasicAuthClient类的具体用法?Java BasicAuthClient怎么用?Java BasicAuthClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BasicAuthClient类属于org.pac4j.http.client包,在下文中一共展示了BasicAuthClient类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkUnautorizedProtocol

import org.pac4j.http.client.BasicAuthClient; //导入依赖的package包/类
@Test
public void checkUnautorizedProtocol() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(Clients.DEFAULT_CLIENT_NAME_PARAMETER, "BasicAuthClient");

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);

    final BasicAuthClient basicAuthClient = new BasicAuthClient();
    final Clients clients = new Clients(MY_LOGIN_URL, basicAuthClient);
    final ClientAction action = new ClientAction(mock(CentralAuthenticationService.class), clients);

    try {
        action.execute(mockRequestContext);
        fail("Should fail as the HTTP protocol is not authorized");
    } catch (final TechnicalException e) {
        assertEquals("Only CAS, OAuth, OpenID and SAML protocols are supported: " + basicAuthClient, e.getMessage());
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:23,代码来源:ClientActionTests.java

示例2: setup

import org.pac4j.http.client.BasicAuthClient; //导入依赖的package包/类
@BeforeMethod
public void setup() {
	basicClient = mock(BasicAuthClient.class);
	when(basicClient.getName()).thenReturn("client1");
	clients = new Clients("/callback", basicClient);
	sessionStore = mock(SessionStore.class);
	configuration = mock(SecurityConfiguration.class);
	when(configuration.getSessionStore()).thenReturn(sessionStore);
	filter = spy(new AuthenticationFilter(clients, configuration));
	context = mock(ContainerRequestContext.class);
	uriInfo = mock(UriInfo.class);
	when(uriInfo.getPath()).thenReturn("/dummy");
	when(context.getUriInfo()).thenReturn(uriInfo);
}
 
开发者ID:minnal,项目名称:minnal,代码行数:15,代码来源:AuthenticationFilterTest.java

示例3: registerPlugins

import org.pac4j.http.client.BasicAuthClient; //导入依赖的package包/类
@Override
protected void registerPlugins() {
	registerPlugin(new JPAPlugin());
	// Add security plugin if enabled
	if(getConfiguration().isEnableSecurity()) {
		BasicAuthClient client = new BasicAuthClient(new SimpleTestUsernamePasswordAuthenticator());
		client.setName("basic");
		registerPlugin(new SecurityPlugin("/callback", client));
	}
}
 
开发者ID:minnal,项目名称:minnal,代码行数:11,代码来源:OrderApplication.java


注:本文中的org.pac4j.http.client.BasicAuthClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。