Skip to content

[BUG] IndexOutOfBoundsException in UUID getDataAccessToken #11905

@mavwolverine

Description

@mavwolverine

Describe the bug
If user does not have a DAT and goes to Download Access Token, it raises a 500 internal server error.

To Reproduce
Steps to reproduce the behavior:
Setup a new system with oAuth2 login.
Configure dat.method = Uuid.
User logs in and select Data Access Token in dropdown.
User clicks "Download token".
It opens a new page with error.

Expected behavior
If not DAT exists, it should create one and share it with user.

Additional context
https://github.com/cBioPortal/cbioportal/blob/master/src/main/java/org/cbioportal/legacy/service/impl/UuidDataAccessTokenServiceImpl.java#L102

public DataAccessToken getDataAccessToken(String username) {
    List<DataAccessToken> allDataAccessTokens =
        dataAccessTokenRepository.getAllDataAccessTokensForUsername(username);
    DataAccessToken newestDataAccessToken = allDataAccessTokens.get(allDataAccessTokens.size() - 1);
    return newestDataAccessToken;
  }

It does not check if allDataAccessTokens len is 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriagetickets that need to be looked at before assigning to team members

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions