Class AbstractIAMResponse

    • Constructor Detail

      • AbstractIAMResponse

        public AbstractIAMResponse​(D4ScienceIAMClient iamClient,
                                   org.gcube.common.keycloak.model.TokenResponse tokenResponse)
    • Method Detail

      • setTokenResponse

        public void setTokenResponse​(org.gcube.common.keycloak.model.TokenResponse tokenResponse)
      • getTokenResponse

        protected org.gcube.common.keycloak.model.TokenResponse getTokenResponse()
      • getAccessTokenString

        public String getAccessTokenString()
        Description copied from interface: IAMResponse
        Returns the access token in the response as string.
        Specified by:
        getAccessTokenString in interface IAMResponse
        Returns:
        The access token as string
      • getRefreshTokenString

        public String getRefreshTokenString()
      • isAccessTokenValid

        public boolean isAccessTokenValid​(boolean checkExpiration)
                                   throws D4ScienceIAMClientException
        Description copied from interface: IAMResponse
        Quick way to check if the access token is valid by checking the digital signature and the token expiration if the checkExpiration parameter is true
        Specified by:
        isAccessTokenValid in interface IAMResponse
        Parameters:
        checkExpiration - checks also if the token is expired
        Returns:
        true if the access token is valid, false otherwise
        Throws:
        D4ScienceIAMClientException - if something goes wrong during the token validity checks
      • verifyAccessToken

        public void verifyAccessToken()
                               throws org.gcube.io.jsonwebtoken.security.SignatureException,
                                      org.gcube.io.jsonwebtoken.ExpiredJwtException,
                                      D4ScienceIAMClientException
        Description copied from interface: IAMResponse
        Verifies the access token integrity and validity; token digital signature and expiration are reported via specific exceptions.
        Specified by:
        verifyAccessToken in interface IAMResponse
        Throws:
        org.gcube.io.jsonwebtoken.security.SignatureException - if the token has been tampered and/or signature is invalid
        org.gcube.io.jsonwebtoken.ExpiredJwtException - if the token validity is expired
        D4ScienceIAMClientException - if something else goes wrong during the token verification
      • isRefreshTokenValid

        public boolean isRefreshTokenValid()
                                    throws D4ScienceIAMClientException
        Description copied from interface: IAMResponse
        Quick way to check if the refresh token present in the current response and it is valid by checking the digital signature and the token expiration
        Specified by:
        isRefreshTokenValid in interface IAMResponse
        Returns:
        true if the refresh token is valid, false otherwise
        Throws:
        D4ScienceIAMClientException - if something goes wrong during the token validity checks
      • isRefreshTokenValid

        public boolean isRefreshTokenValid​(boolean checkExpiration)
                                    throws D4ScienceIAMClientException
        Description copied from interface: IAMResponse
        Quick way to check if the refresh token present in the current response and it is valid by checking the digital signature and the token expiration if the checkExpiration parameter is true
        Specified by:
        isRefreshTokenValid in interface IAMResponse
        Parameters:
        checkExpiration - checks also if the token is expired
        Returns:
        true if the refresh token is valid, false otherwise
        Throws:
        D4ScienceIAMClientException - if something goes wrong during the token validity checks
      • verifyRefreshToken

        public void verifyRefreshToken()
                                throws org.gcube.io.jsonwebtoken.security.SignatureException,
                                       org.gcube.io.jsonwebtoken.ExpiredJwtException,
                                       D4ScienceIAMClientException
        Description copied from interface: IAMResponse
        Verifies the refresh token integrity and validity; token digital signature and expiration are reported via specific exceptions.
        Specified by:
        verifyRefreshToken in interface IAMResponse
        Throws:
        org.gcube.io.jsonwebtoken.security.SignatureException - if the token has been tampered and/or signature is invalid
        org.gcube.io.jsonwebtoken.ExpiredJwtException - if the token validity is expired
        D4ScienceIAMClientException - if something else goes wrong during the token verification