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 SecuritySchemeHTTPSecurityScheme describes credentials sent in an HTTP header, following the HTTP authentication framework (RFC 9110, section 11): a client sends<header>: <scheme> <credentials>. Theschemeis taken from the IANA HTTP Authentication Scheme Registry. Its fields mirror thehttpandapiKeytypes 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 sendsAuthorization: Bearer <token>, with a token issued by the OpenID Connect provider described aturl. - 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 sendsAuthorization: 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 sendsX-API-Key: <key>, with a key obtained aturl.
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description static StringHEADER_PROPERTYThe name of the property holding the HTTP header carrying the credentialsstatic StringNAMEThe name associated with this property-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, REDACTED, TYPE_PROPERTY, UNKNOWN_USER
-
Fields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY
-
Fields inherited from interface org.gcube.resourcemanagement.model.reference.properties.SecurityScheme
DESCRIPTION_PROPERTY, REFERENCE_PROPERTY, SCHEME_PROPERTY, URL_PROPERTY
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static HTTPSecuritySchemegetDefaultInstance()Returns a default instance of HTTPSecuritySchemeStringgetHeader()The HTTP header field carrying the credentials, e.g.StringgetScheme()The authentication scheme used in the header value, as registered in the IANA HTTP Authentication Scheme Registry, e.g.voidsetHeader(String header)Sets the HTTP header carrying the credentials-
Methods inherited from interface org.gcube.informationsystem.model.reference.ModelElement
getExpectedType, getSupertypes
-
Methods inherited from interface org.gcube.informationsystem.model.reference.properties.Property
getAdditionalProperties, getAdditionalProperty, setAdditionalProperties, setAdditionalProperty
-
Methods inherited from interface org.gcube.resourcemanagement.model.reference.properties.SecurityScheme
getDescription, getReference, getURL, setDescription, setReference, setScheme, setURL
-
-
-
-
Field Detail
-
NAME
static final String NAME
The name associated with this property- See Also:
- Constant Field Values
-
HEADER_PROPERTY
static final String HEADER_PROPERTY
The name of the property holding the HTTP header carrying the credentials- See Also:
- Constant Field Values
-
-
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 asX-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) orBasic(RFC 7617);nullwhen the header carries the credentials alone, as an API key header does.- Specified by:
getSchemein interfaceSecurityScheme- Returns:
- the authentication scheme
-
-