That depends on the usermanagement you're using in your community.
I've done something similar on my site.
If you are logged in via SSO, ubb.threads will notice that and log you in aswell.
If you log into ubb.threads, the SSO session is also created.
I'm using a login_handler class for this. So I only need to add a few lines to ubb.threads and load another class.
Basically, you have to create the ubb.threads cookies or session within your SSO-script and create your SSO session within the ubb.threads login function.