Class AuthorizationToken

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AuthorizationToken()
      Constructor for token implementations is internal - use parse(String) to create tokens
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getToken()
      Retrieve the authorization token text
      String getType()
      Retrieve the IANA HTTP Authentication Scheme Name this token is an implementation of
      boolean is​(String type)
      Check whether the token implementation implements the specified IANA HTTP Authentication Scheme Name
      static AuthorizationToken parse​(String authorizationHeader)
      Parse an Authorization header text to create a specific token implementation This method uses the convention of the first word in the Authorization value being the IANA HTTP Authentication Scheme Name, to dynamically load an appropriate implementation from the tech.greenfield.vertx.irked.auth.AuthorizationToken service loader.
      protected boolean supports​(String type)
      Check whether an AuthorizationToken implementation supports the speciefied IANA HTTP Authentication Scheme Name
      String toString()  
      protected AuthorizationToken update​(String type, String token)
      Update a service-loader loaded implementation with the actual details
    • Constructor Detail

      • AuthorizationToken

        protected AuthorizationToken()
        Constructor for token implementations is internal - use parse(String) to create tokens
    • Method Detail

      • parse

        public static AuthorizationToken parse​(String authorizationHeader)
        Parse an Authorization header text to create a specific token implementation This method uses the convention of the first word in the Authorization value being the IANA HTTP Authentication Scheme Name, to dynamically load an appropriate implementation from the tech.greenfield.vertx.irked.auth.AuthorizationToken service loader. If the header value is incompatible (i.e. contains only one "word") then a token with the type "simple" will be returned. Otherwise if no supporting implementation is found, an instance of the AuthorizationToken class will be created.
        Parameters:
        authorizationHeader - value of the HTTP Authorization header
        Returns:
        a
      • update

        protected AuthorizationToken update​(String type,
                                            String token)
        Update a service-loader loaded implementation with the actual details
        Parameters:
        type - IANA HTTP Authentication Scheme Name
        token - token text
        Returns:
        itself for fluent calling
      • supports

        protected boolean supports​(String type)
        Check whether an AuthorizationToken implementation supports the speciefied IANA HTTP Authentication Scheme Name
        Parameters:
        type - IANA HTTP Authentication Scheme Name
        Returns:
        whether this implementation supports the specified name
      • is

        public boolean is​(String type)
        Check whether the token implementation implements the specified IANA HTTP Authentication Scheme Name
        Parameters:
        type - IANA HTTP Authentication Scheme Name
        Returns:
        whether the implementation is valid for that scheme name
      • getToken

        public String getToken()
        Retrieve the authorization token text
        Returns:
        authorization token text
      • getType

        public String getType()
        Retrieve the IANA HTTP Authentication Scheme Name this token is an implementation of
        Returns:
        IANA HTTP Authentication Scheme Name