Replace slice arithmetic to parse credentials with TrimSuffix method.

[#84254760]

Signed-off-by: David Wadden <dwadden@pivotal.io>