use of org.apereo.inspektr.common.web.ClientInfo in project cas by apereo.
the class CasEventsReportEndpointTests method initialize.
@BeforeEach
public void initialize() {
val request = new MockHttpServletRequest();
request.setRemoteAddr("223.456.789.100");
request.setLocalAddr("223.456.789.100");
request.addHeader(HttpRequestUtils.USER_AGENT_HEADER, "test");
ClientInfoHolder.setClientInfo(new ClientInfo(request));
}
use of org.apereo.inspektr.common.web.ClientInfo in project cas by apereo.
the class CasAuthenticationEventListenerTests method initialize.
@BeforeEach
public void initialize() {
val request = new MockHttpServletRequest();
request.setRemoteAddr("123.456.789.000");
request.setLocalAddr("123.456.789.000");
request.addHeader(HttpRequestUtils.USER_AGENT_HEADER, "test");
ClientInfoHolder.setClientInfo(new ClientInfo(request));
}
use of org.apereo.inspektr.common.web.ClientInfo in project cas by apereo.
the class HttpRequestRegisteredServiceAccessStrategyTests method setup.
@BeforeEach
public void setup() {
val request = new MockHttpServletRequest();
request.setRemoteAddr("192.861.151.163");
request.addHeader(HttpRequestUtils.USER_AGENT_HEADER, "Chrome/Mozilla");
ClientInfoHolder.setClientInfo(new ClientInfo(request));
}
use of org.apereo.inspektr.common.web.ClientInfo in project cas by apereo.
the class NoOpPasswordManagementServiceTests method verifyTokenParsing.
@Test
public void verifyTokenParsing() {
val request = new MockHttpServletRequest();
request.setRemoteAddr("185.86.151.11");
request.setLocalAddr("185.88.151.11");
val clientInfo = new ClientInfo(request);
ClientInfoHolder.setClientInfo(clientInfo);
val properties = new PasswordManagementProperties();
val service = new NoOpPasswordManagementService(CipherExecutor.noOpOfSerializableToString(), "CAS", properties);
val token = UUID.randomUUID().toString();
val claims = new JwtClaims();
claims.setJwtId(token);
claims.setIssuer("bad-issuer");
assertNull(service.parseToken(claims.toJson()));
claims.setIssuer("CAS");
claims.setAudience("other-audience");
assertNull(service.parseToken(claims.toJson()));
claims.setAudience("CAS");
claims.setSubject(StringUtils.EMPTY);
assertNull(service.parseToken(claims.toJson()));
claims.setClaim("origin", "whatever");
claims.setSubject("casuser");
assertNull(service.parseToken(claims.toJson()));
claims.setClaim("origin", clientInfo.getServerIpAddress());
claims.setClaim("client", "whatever");
assertNull(service.parseToken(claims.toJson()));
claims.setClaim("client", clientInfo.getClientIpAddress());
val milli = Instant.now(Clock.systemUTC()).minusSeconds(500).toEpochMilli();
claims.setExpirationTime(NumericDate.fromMilliseconds(milli));
assertNull(service.parseToken(claims.toJson()));
claims.setExpirationTime(NumericDate.now());
assertNotNull(service.parseToken(claims.toJson()));
}
use of org.apereo.inspektr.common.web.ClientInfo in project cas by apereo.
the class LdapPasswordManagementServiceTests method bootstrap.
@BeforeAll
public static void bootstrap() throws Exception {
ClientInfoHolder.setClientInfo(new ClientInfo(new MockHttpServletRequest()));
val localhost = new LDAPConnection("localhost", LDAP_PORT, "cn=Directory Manager", "password");
LdapIntegrationTestsOperations.populateEntries(localhost, new ClassPathResource("ldif/ldap-pm.ldif").getInputStream(), "ou=people,dc=example,dc=org", new BindConnectionInitializer("cn=Directory Manager", new Credential("password")));
}
Aggregations