Port pebduroam code from cloudpebble