Why are we getting ‘HTTP Status 500 – Bad credentials’ when trying to login to Artifactory?

Here is a part of  the stacktrace of the exception when attempting to login to Artifactory:

HTTP Status 500 – Bad credentials

message Bad credentials

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.security.authentication.BadCredentialsException: Bad credentials

        org.springframework.security.authentication.dao.DaoAuthenticationProvider.additionalAuthenticationChecks(DaoAuthenticationProvider.java:87)

        org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:149)

        org.artifactory.security.db.DbAuthenticationProvider.authenticate(DbAuthenticationProvider.java:47)

        org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)

        org.artifactory.security.RealmAwareAuthenticationManager.authenticate(RealmAwareAuthenticationManager.java:72)

This is probably caused by a corruption of the anonymous user entry in the database. 

The easiest way to overcome this problem is to login to the database, delete the existing anonymous user entry on the ‘users’ table, and then to restart artifactory. 

This will force artifactory to recreate the anonymous user to allow you to login to Artifactory.