Refactor some credentials logic

- Expose all ports
- Move credential's port logic to credentials model
- Backfill credentials tests