Class Xs2aAuthorisationService


  • @Service
    public class Xs2aAuthorisationService
    extends Object
    • Constructor Detail

      • Xs2aAuthorisationService

        public Xs2aAuthorisationService()
    • Method Detail

      • createAuthorisation

        public Optional<de.adorsys.psd2.consent.api.authorisation.CreateAuthorisationResponse> createAuthorisation​(de.adorsys.psd2.consent.api.authorisation.CreateAuthorisationRequest request,
                                                                                                                   String parentId,
                                                                                                                   de.adorsys.psd2.xs2a.core.authorisation.AuthorisationType authorisationType)
        Stores created authorisation
        Parameters:
        parentId - String representation of identifier of stored parent
        Returns:
        CreateAuthorisationResponse object with authorisation ID and scaStatus
      • getAuthorisationById

        public Optional<de.adorsys.psd2.xs2a.core.authorisation.Authorisation> getAuthorisationById​(String authorisationId)
        Requests CMS to retrieve authorisation by its identifier
        Parameters:
        authorisationId - String representation of identifier of stored consent authorisation
        Returns:
        Response contains Authorisation
      • updateScaApproach

        public void updateScaApproach​(String authorisationId,
                                      de.adorsys.psd2.xs2a.core.profile.ScaApproach scaApproach)
        Updates SCA approach in authorisation
        Parameters:
        authorisationId - String representation of the authorisation identifier
        scaApproach - Chosen SCA approach
      • saveAuthenticationMethods

        public boolean saveAuthenticationMethods​(String authorisationId,
                                                 List<de.adorsys.psd2.xs2a.core.authorisation.AuthenticationObject> methods)
        Saves authentication methods in provided authorisation
        Parameters:
        authorisationId - String representation of the authorisation identifier
        methods - List of authentication methods to be saved
        Returns:
        true if authorisation was found and updated, false otherwise
      • isAuthenticationMethodDecoupled

        public boolean isAuthenticationMethodDecoupled​(String authorisationId,
                                                       String authenticationMethodId)
        Requests CMS to retrieve authentication method and checks if requested authentication method is decoupled.
        Parameters:
        authorisationId - String representation of the authorisation identifier
        authenticationMethodId - String representation of the available authentication method identifier
        Returns:
        true, if authentication method is decoupled and false otherwise.
      • updateAuthorisationStatus

        public void updateAuthorisationStatus​(String authorisationId,
                                              de.adorsys.psd2.xs2a.core.sca.ScaStatus scaStatus)
        Sends a PUT request to CMS to update status in authorisation
        Parameters:
        authorisationId - String representation of authorisation identifier
        scaStatus - Enum for status of the SCA method applied
      • getAuthorisationScaApproach

        public Optional<de.adorsys.psd2.xs2a.core.sca.AuthorisationScaApproachResponse> getAuthorisationScaApproach​(String authorisationId)
        Gets SCA approach from the authorisation
        Parameters:
        authorisationId - String representation of the authorisation identifier
        Returns:
        SCA approach
      • getAuthorisationSubResources

        public Optional<List<String>> getAuthorisationSubResources​(String parentId,
                                                                   de.adorsys.psd2.xs2a.core.authorisation.AuthorisationType authorisationType)
        Requests to retrieve authorisation IDs by parent ID
        Parameters:
        parentId - String representation of identifier of stored consent
        Returns:
        list of consent authorisation IDs
      • updateAuthorisation

        public de.adorsys.psd2.consent.api.CmsResponse<de.adorsys.psd2.xs2a.core.authorisation.Authorisation> updateAuthorisation​(de.adorsys.psd2.consent.api.authorisation.UpdateAuthorisationRequest request,
                                                                                                                                  String authorisationId)
      • getAuthorisationScaStatus

        public Optional<de.adorsys.psd2.xs2a.core.sca.ScaStatus> getAuthorisationScaStatus​(String authorisationId,
                                                                                           String parentId,
                                                                                           de.adorsys.psd2.xs2a.core.authorisation.AuthorisationType authorisationType)
        Retrieves SCA status of authorisation
        Parameters:
        parentId - String representation of consent identifier
        authorisationId - String representation of authorisation identifier
        Returns:
        SCA status of the authorisation