Codota Logo
Cas20ServiceTicketValidator.validate
Code IndexAdd Codota to your IDE (free)

How to use
validate
method
in
org.jasig.cas.client.validation.Cas20ServiceTicketValidator

Best Java code snippets using org.jasig.cas.client.validation.Cas20ServiceTicketValidator.validate (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: apereo/java-cas-client

  @Test
  public void testInvalidResponse() throws Exception {
    final String RESPONSE = "<root />";
    server.content = RESPONSE.getBytes(server.encoding);
    try {
      this.ticketValidator.validate("test", "test");
      fail("ValidationException expected due to invalid response.");
    } catch (final TicketValidationException e) {
      // expected
    }
  }
}
origin: apereo/java-cas-client

@Test
public void testNoResponse() throws UnsupportedEncodingException {
  final String RESPONSE = "<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'><cas:authenticationFailure code=\"INVALID_TICKET\">Ticket ST-1856339-aA5Yuvrxzpv8Tau1cYQ7 not recognized</cas:authenticationFailure></cas:serviceResponse>";
  server.content = RESPONSE.getBytes(server.encoding);
  try {
    this.ticketValidator.validate("test", "test");
    fail("ValidationException expected due to 'no' response");
  } catch (final TicketValidationException e) {
    // expected
  }
}
origin: apereo/java-cas-client

@Test
public void testYesResponseButNoPgt() throws TicketValidationException, UnsupportedEncodingException {
  final String USERNAME = "username";
  final String RESPONSE = "<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'><cas:authenticationSuccess><cas:user>"
      + USERNAME + "</cas:user></cas:authenticationSuccess></cas:serviceResponse>";
  server.content = RESPONSE.getBytes(server.encoding);
  final Assertion assertion = this.ticketValidator.validate("test", "test");
  assertEquals(USERNAME, assertion.getPrincipal().getName());
}
origin: apereo/java-cas-client

@Test
public void testYesResponseWithPgt() throws TicketValidationException, UnsupportedEncodingException {
  final String USERNAME = "username";
  final String PGTIOU = "testPgtIou";
  final String PGT = "test";
  final String RESPONSE = "<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'><cas:authenticationSuccess><cas:user>"
      + USERNAME
      + "</cas:user><cas:proxyGrantingTicket>"
      + PGTIOU
      + "</cas:proxyGrantingTicket></cas:authenticationSuccess></cas:serviceResponse>";
  server.content = RESPONSE.getBytes(server.encoding);
  this.proxyGrantingTicketStorage.save(PGTIOU, PGT);
  final Assertion assertion = this.ticketValidator.validate("test", "test");
  assertEquals(USERNAME, assertion.getPrincipal().getName());
  //        assertEquals(PGT, assertion.getProxyGrantingTicketId());
}
origin: apereo/java-cas-client

@Test
public void testGetAttributes() throws TicketValidationException, UnsupportedEncodingException {
  final String USERNAME = "username";
  final String PGTIOU = "testPgtIou";
  final String RESPONSE = "<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'><cas:authenticationSuccess><cas:user>"
      + USERNAME
      + "</cas:user><cas:proxyGrantingTicket>"
      + PGTIOU
      + "</cas:proxyGrantingTicket><cas:attributes><cas:password>test</cas:password><cas:eduPersonId>id</cas:eduPersonId><cas:longAttribute>test1\n\ntest</cas:longAttribute><cas:multivaluedAttribute>value1</cas:multivaluedAttribute><cas:multivaluedAttribute>value2</cas:multivaluedAttribute></cas:attributes></cas:authenticationSuccess></cas:serviceResponse>";
  server.content = RESPONSE.getBytes(server.encoding);
  final Assertion assertion = this.ticketValidator.validate("test", "test");
  assertEquals(USERNAME, assertion.getPrincipal().getName());
  assertEquals("test", assertion.getPrincipal().getAttributes().get("password"));
  assertEquals("id", assertion.getPrincipal().getAttributes().get("eduPersonId"));
  assertEquals("test1\n\ntest", assertion.getPrincipal().getAttributes().get("longAttribute"));
  try {
    List<?> multivalued = (List<?>) assertion.getPrincipal().getAttributes().get("multivaluedAttribute");
    assertArrayEquals(new String[] { "value1", "value2" }, multivalued.toArray());
  } catch (Exception e) {
    fail("'multivaluedAttribute' attribute expected as List<Object> object.");
  }
  //assertEquals(PGT, assertion.getProxyGrantingTicketId());
}
org.jasig.cas.client.validationCas20ServiceTicketValidatorvalidate

Popular methods of Cas20ServiceTicketValidator

  • <init>
    Constructs an instance of the CAS 2.0 Service Ticket Validator with the supplied CAS server url pref
  • setProxyCallbackUrl
  • setProxyGrantingTicketStorage
  • setRenew
  • setEncoding
  • setProxyRetriever
  • customParseResponse
    Template method if additional custom parsing (such as Proxying) needs to be done.
  • extractCustomAttributes
    Default attribute parsing of attributes that look like the following:
  • getEncoding
  • setCustomParameters
  • encodeUrl
  • getURLConnectionFactory
  • encodeUrl,
  • getURLConnectionFactory,
  • parseAuthenticationFailureFromResponse,
  • parsePrincipalFromResponse,
  • parseProxyGrantingTicketFromResponse,
  • setHostnameVerifier,
  • setURLConnectionFactory

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now