       static        :
         getUrl      : (signature Object, Function)
 
-
-  checkGroupGitLabSettings = (client, callback) ->
-
-    { sessionToken: clientId, context: { group: slug } } = client
-
-    JSession = require './session'
-    JSession.one { clientId }, (err, session) ->
-      return callback err  if err
-      return callback new KodingError 'Session invalid'  unless session
-
-      JGroup = require './group'
-      JGroup.one { slug }, (err, group) ->
-
-        if not err and group and group.config?.gitlab?.enabled
-
-          settings = {
-            url: group.config.gitlab.url
-            applicationId: group.config.gitlab.applicationId
-            state: session._id
-          }
-
-          callback null, settings
-
-        else
-
-          callback new KodingError 'Integration is not enabled'
-
-
-
-  getUrlFor = (client, urlOptions, callback) ->
-
-    { provider, redirectUri } = urlOptions
-
-    ({
-
-      github: ->
-
-        { clientId } = KONFIG.github
-        { scope, returnUrl } = urlOptions
-        scope = 'user:email'  unless scope
-        redirectUri = "#{redirectUri}?returnUrl=#{returnUrl}"  if returnUrl
-        url = "https://github.com/login/oauth/authorize?client_id=#{clientId}&scope=#{scope}&redirect_uri=#{redirectUri}"
-
-        callback null, url
-
-
-      gitlab: ->
-
-        { returnUrl } = urlOptions
+  NOTSUPPORTEDERR = new KodingError 'OAuth provider is not supported'
+
+  @PROVIDERS =
+
+    # -- GITLAB PROVIDER --------------------------------------------------8<--
+
+    gitlab    :
+      title   : 'GitLab OAuth Provider'
+      enabled : true
+      getUrl  : (client, urlOptions, callback) ->
+
+        checkGroupGitLabSettings = (client, callback) ->
+
+          { sessionToken: clientId, context: { group: slug } } = client
+
+          JSession = require './session'
+          JSession.one { clientId }, (err, session) ->
+            return callback err  if err
+            return callback new KodingError 'Session invalid'  unless session
+
+            JGroup = require './group'
+            JGroup.one { slug }, (err, group) ->
+
+              if not err and group and group.config?.gitlab?.enabled
+
+                settings = {
+                  url: group.config.gitlab.url
+                  applicationId: group.config.gitlab.applicationId
+                  state: session._id
+                }
+
+                callback null, settings
+
+              else
+
+                callback new KodingError 'Integration is not enabled'
+
+        { returnUrl, redirectUri } = urlOptions
         { applicationId, host, port } = KONFIG.gitlab
         host ?= 'gitlab.com'
         protocol = '//'


        callback null, url

    }[provider] ? -> callback new KodingError 'No such provider')()


  @getUrl = secure (client, urlOptions, callback) ->

    { provider } = urlOptions
    { context: { group } } = client

    urlOptions.redirectUri = \
      "http://#{group}.#{KONFIG.hostname}/-/oauth/#{provider}/callback"

    getUrlFor client, urlOptions, callback


  @prependGroupName = (url, groupName) ->

          callback null, url


    # -- LINKEDIN PROVIDER ------------------------------------------------8<--

    linkedin  :
      title   : 'LinkedIn OAuth Provider'
      enabled : false
      getUrl  : (client, urlOptions, callback) ->

        { client_id } = KONFIG.linkedin
        { redirectUri } = urlOptions

        state = crypto.createHash('md5')
          .update((new Date).toString())
          .digest('hex')

        url  = 'https://www.linkedin.com/uas/oauth2/authorization?'
        url += 'response_type=code&'
