Interface HTTPSecurityScheme

  • All Superinterfaces:
    org.gcube.informationsystem.base.reference.Element, GCubeProperty, org.gcube.informationsystem.model.reference.ModelElement, org.gcube.informationsystem.model.reference.properties.Property, org.gcube.informationsystem.base.reference.properties.PropertyElement, org.gcube.informationsystem.base.reference.SchemaMixedElement, SecurityScheme, Serializable
    All Known Implementing Classes:
    HTTPSecuritySchemeImpl

    @TypeMetadata(name="HTTPSecurityScheme",
                  description="HTTPSecurityScheme describes credentials sent in an HTTP header, following the HTTP authentication framework (RFC 9110, section 11: https://www.rfc-editor.org/rfc/rfc9110#section-11): a client sends \'<header>: <scheme> <credentials>\'. The scheme is taken from the IANA HTTP Authentication Scheme Registry (https://www.iana.org/assignments/http-authschemes). Its fields mirror the \'http\' and \'apiKey\' types of the Security Scheme Object of the OpenAPI Specification (https://spec.openapis.org/oas/v3.1.0#security-scheme-object). Examples: a gCube service called with a bearer token (RFC 6750) issued by the D4Science IAM is {\"header\": \"Authorization\", \"scheme\": \"Bearer\", \"reference\": \"[RFC 6750](https://www.rfc-editor.org/rfc/rfc6750)\", \"url\": \"https://accounts.d4science.org/auth/realms/d4science/.well-known/openid-configuration\", \"description\": \"Tokens issued by the D4Science IAM for the Context of the call\"}, i.e. the client sends \'Authorization: Bearer <token>\'; a service protected by HTTP Basic authentication (RFC 7617) is {\"header\": \"Authorization\", \"scheme\": \"Basic\", \"reference\": \"[RFC 7617](https://www.rfc-editor.org/rfc/rfc7617)\"}, i.e. the client sends \'Authorization: Basic <base64 of username:password>\'; a service protected by an API key sent in a dedicated header is {\"header\": \"X-API-Key\", \"url\": \"https://example.org/api-keys\"}, i.e. the client sends \'X-API-Key: <key>\'.",
                  version="1.0.0")
    @Change(version="1.0.0",
            description="First Version")
    public interface HTTPSecurityScheme
    extends SecurityScheme
    HTTPSecurityScheme describes credentials sent in an HTTP header, following the HTTP authentication framework (RFC 9110, section 11): a client sends <header>: <scheme> <credentials>. The scheme is taken from the IANA HTTP Authentication Scheme Registry. Its fields mirror the http and apiKey types of the Security Scheme Object of the OpenAPI Specification.

    Examples:

    • A gCube service, called with a bearer token (RFC 6750) issued by the D4Science IAM:
       { "type": "HTTPSecurityScheme", "header": "Authorization", "scheme": "Bearer",
         "reference": "[RFC 6750](https://www.rfc-editor.org/rfc/rfc6750)",
         "url": "https://accounts.d4science.org/auth/realms/d4science/.well-known/openid-configuration",
         "description": "Tokens issued by the D4Science IAM for the Context of the call" }
       
      the client sends Authorization: Bearer <token>, with a token issued by the OpenID Connect provider described at url.
    • A service protected by HTTP Basic authentication (RFC 7617):
       { "type": "HTTPSecurityScheme", "header": "Authorization", "scheme": "Basic",
         "reference": "[RFC 7617](https://www.rfc-editor.org/rfc/rfc7617)" }
       
      the client sends Authorization: Basic <base64 of username:password>.
    • A service protected by an API key sent in a dedicated header, with no scheme:
       { "type": "HTTPSecurityScheme", "header": "X-API-Key", "url": "https://example.org/api-keys" }
       
      the client sends X-API-Key: <key>, with a key obtained at url.
    Author:
    Luca Frosini (ISTI - CNR)
    • Method Detail

      • getDefaultInstance

        static HTTPSecurityScheme getDefaultInstance()
        Returns a default instance of HTTPSecurityScheme
        Returns:
        a default instance of HTTPSecurityScheme
      • getHeader

        @ISProperty(name="header",
                    description="The HTTP header field carrying the credentials, e.g. \'Authorization\' (RFC 9110, section 11.6.2: https://www.rfc-editor.org/rfc/rfc9110#section-11.6.2) or an API key header such as \'X-API-Key\'.",
                    mandatory=true)
        String getHeader()
        The HTTP header field carrying the credentials, e.g. Authorization (RFC 9110, section 11.6.2) or an API key header such as X-API-Key.
        Returns:
        the HTTP header carrying the credentials
      • setHeader

        void setHeader​(String header)
        Sets the HTTP header carrying the credentials
        Parameters:
        header - the HTTP header carrying the credentials, e.g. Authorization
      • getScheme

        @ISProperty(name="scheme",
                    description="The authentication scheme used in the header value, as registered in the IANA HTTP Authentication Scheme Registry (https://www.iana.org/assignments/http-authschemes), e.g. \'Bearer\' (RFC 6750: https://www.rfc-editor.org/rfc/rfc6750) or \'Basic\' (RFC 7617: https://www.rfc-editor.org/rfc/rfc7617). Empty when the header carries the credentials alone, as an API key header such as \'X-API-Key\' does.")
        String getScheme()
        The authentication scheme used in the header value, as registered in the IANA HTTP Authentication Scheme Registry, e.g. Bearer (RFC 6750) or Basic (RFC 7617); null when the header carries the credentials alone, as an API key header does.
        Specified by:
        getScheme in interface SecurityScheme
        Returns:
        the authentication scheme