Class SsaRestWebServiceValidator


  • @Named
    public class SsaRestWebServiceValidator
    extends Object
    Provides methods to validate different params about SSA.
    • Constructor Detail

      • SsaRestWebServiceValidator

        public SsaRestWebServiceValidator()
    • Method Detail

      • getClientFromSession

        public io.jans.as.common.model.registration.Client getClientFromSession()
                                                                         throws jakarta.ws.rs.WebApplicationException
        Get client from session
        Returns:
        Client if obtained.
        Throws:
        jakarta.ws.rs.WebApplicationException - with status 401 and key INVALID_CLIENT if the client cannot be obtained.
      • checkScopesPolicy

        public void checkScopesPolicy​(io.jans.as.common.model.registration.Client client,
                                      String scope)
                               throws jakarta.ws.rs.WebApplicationException
        Check if the client has the given scope.
        Parameters:
        client - Client to check scope
        scope - Scope to validate
        Throws:
        jakarta.ws.rs.WebApplicationException - with status 401 and key UNAUTHORIZED_CLIENT if you don't have the scope.
      • checkScopesPolicy

        public void checkScopesPolicy​(io.jans.as.common.model.registration.Client client,
                                      List<String> scopeList)
                               throws jakarta.ws.rs.WebApplicationException
        Check if the client has at least one scope from the list of scopes.
        Parameters:
        client - Client to check scope
        scopeList - List of scope to validated
        Throws:
        jakarta.ws.rs.WebApplicationException - with status 401 (Unauthorized) with unauthorized_client key, when it does not have the scope.
      • getValidSsaByJti

        public io.jans.as.common.model.ssa.Ssa getValidSsaByJti​(String jti)
        Find SSA based on "jti" and validated
        Parameters:
        jti - Unique identifier
        Returns:
        A Ssa validated
        Throws:
        jakarta.ws.rs.WebApplicationException - with status 400 (Bad Request) with <b>invalid_jti<b/> key, when jti does not exist, is invalid or state is in (expired, used or revoked)
      • validateSsaCreateRequest

        public void validateSsaCreateRequest​(io.jans.as.client.ssa.create.SsaCreateRequest createRequest)
        Validate SSA Metadata

        This method validates the metadata of a new SSA. - "lifetime" cannot be 0 or negative

        Parameters:
        createRequest - SSA Metadata
        Throws:
        jakarta.ws.rs.WebApplicationException - with status 400 (Bad Request) with invalid_ssa_metadata key, when lifetime is invalid