Class DefaultRedirectUriCreationFunction

    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • callbackServletPath

        @NonnullAfterInit
        @NotEmpty
        private String callbackServletPath
        The path, excluding the context and servlet paths, to the RP callback handler.
      • allowedOrigins

        @NonnullAfterInit
        private Set<String> allowedOrigins
        A set of 'allowed' origins that can be used as the scheme, host, and port portion of the redirectURI. Can be null, if so a redirect_uri must be specified in the context tree.
    • Constructor Detail

      • DefaultRedirectUriCreationFunction

        public DefaultRedirectUriCreationFunction()
        Constructor.
    • Method Detail

      • setCallbackServletPath

        public void setCallbackServletPath​(@Nonnull @NotEmpty
                                           String path)
        Set the path segment relative to the servlet path of the callback endpoint.
        Parameters:
        path - the callback servlet path
      • setAllowedOrigins

        public void setAllowedOrigins​(@Nullable
                                      Set<String> origins)
        Set the allowed origins to use if a redirect_uri is computed.
        Parameters:
        origins - the origins
      • buildOrigin

        @Nonnull
        private String buildOrigin​(@Nonnull
                                   URI uri)
                            throws URISyntaxException
        Builds the 'origin' (see RFC 6454) from given URI. Omits default or unknown ports.
        Parameters:
        uri - the URI to build the origin from
        Returns:
        the origin
        Throws:
        URISyntaxException - if there is an error getting information from the URI.
      • buildURIIgnoreDefaultPorts

        @Nonnull
        private final URI buildURIIgnoreDefaultPorts​(@Nonnull
                                                     String scheme,
                                                     @Nonnull
                                                     String host,
                                                     @Nonnull
                                                     int port,
                                                     @Nonnull
                                                     String path)
                                              throws URISyntaxException
        Build a URI from the given parameters. If the scheme is either 'http' or 'https' with their respective default port, the port is set to -1.
        Parameters:
        scheme - the scheme
        host - the hostname
        port - the port
        path - the path
        Returns:
        a fully built URI from the given parameters.
        Throws:
        URISyntaxException - if the URI can not be constructed.