For this functionality you must consider how frequently users are likely to enable or disable the feature. I see no problem in keeping all the settings intact when user sets it for the first time.
Additionally you can,
- Ask user if they want to clear out the settings when they disable.
- Ask user to use the previous settings when they enable again.
Just because the system has credentials, I would not clear it out. The credential information is still held securely by the system. In fact if the operation of enabling and disabling is frequent the constant need to re-enter everything is going to dent your user experience.
If this is a one of case, or when user disables, it is going to stay that way for a long time, then as I said, you can prompt user to clear out the configuration of the feature.
Also, I would refrain from using a checkbox if that hides a big configuration. I might be wrong but many times, I identify checkboxes with quick changes you make to the system. A configuration form that follows after change of checkbox, may not be a good UX. I would instead have a button that opens up the configuration dialog and has options to enable / clear.