You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

new.tmpl 4.6 kB

Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
8 years ago
Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
5 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. {{template "base/head" .}}
  2. <div class="admin new authentication">
  3. {{template "admin/navbar" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. <h4 class="ui top attached header">
  7. {{.i18n.Tr "admin.auths.new"}}
  8. </h4>
  9. <div class="ui attached segment">
  10. <form class="ui form" action="{{.Link}}" method="post">
  11. {{.CsrfTokenHtml}}
  12. <!-- Types and name -->
  13. <div class="inline required field {{if .Err_Type}}error{{end}}">
  14. <label>{{.i18n.Tr "admin.auths.auth_type"}}</label>
  15. <div class="ui selection type dropdown">
  16. <input type="hidden" id="auth_type" name="type" value="{{.type}}">
  17. <div class="text">{{.CurrentTypeName}}</div>
  18. <i class="dropdown icon"></i>
  19. <div class="menu">
  20. {{range .AuthSources}}
  21. <div class="item" data-value="{{.Type}}">{{.Name}}</div>
  22. {{end}}
  23. </div>
  24. </div>
  25. </div>
  26. <div class="required inline field {{if .Err_Name}}error{{end}}">
  27. <label for="name">{{.i18n.Tr "admin.auths.auth_name"}}</label>
  28. <input id="name" name="name" value="{{.name}}" autofocus required>
  29. </div>
  30. <!-- LDAP and DLDAP -->
  31. {{ template "admin/auth/source/ldap" . }}
  32. <!-- SMTP -->
  33. {{ template "admin/auth/source/smtp" . }}
  34. <!-- PAM -->
  35. <div class="pam required field {{if not (eq .type 4)}}hide{{end}}">
  36. <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label>
  37. <input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}" />
  38. </div>
  39. <!-- OAuth2 -->
  40. {{ template "admin/auth/source/oauth" . }}
  41. <!-- SSPI -->
  42. {{ template "admin/auth/source/sspi" . }}
  43. <div class="ldap field">
  44. <div class="ui checkbox">
  45. <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label>
  46. <input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}>
  47. </div>
  48. </div>
  49. <div class="smtp inline field {{if not (eq .type 3)}}hide{{end}}">
  50. <div class="ui checkbox">
  51. <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label>
  52. <input name="tls" type="checkbox" {{if .tls}}checked{{end}}>
  53. </div>
  54. </div>
  55. <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
  56. <div class="ui checkbox">
  57. <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label>
  58. <input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}>
  59. </div>
  60. </div>
  61. <div class="ldap inline field {{if not (eq .type 2)}}hide{{end}}">
  62. <div class="ui checkbox">
  63. <label><strong>{{.i18n.Tr "admin.auths.syncenabled"}}</strong></label>
  64. <input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}>
  65. </div>
  66. </div>
  67. <div class="inline field">
  68. <div class="ui checkbox">
  69. <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label>
  70. <input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}>
  71. </div>
  72. </div>
  73. <div class="field">
  74. <button class="ui green button">{{.i18n.Tr "admin.auths.new"}}</button>
  75. </div>
  76. </form>
  77. </div>
  78. <h4 class="ui top attached header">
  79. {{.i18n.Tr "admin.auths.tips"}}
  80. </h4>
  81. <div class="ui attached segment">
  82. <h5>GMail Settings:</h5>
  83. <p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>
  84. <h5>{{.i18n.Tr "admin.auths.tips.oauth2.general"}}:</h5>
  85. <p>{{.i18n.Tr "admin.auths.tips.oauth2.general.tip"}}</p>
  86. <h5 class="ui top attached header">{{.i18n.Tr "admin.auths.tip.oauth2_provider"}}</h5>
  87. <div class="ui attached segment">
  88. <li>Bitbucket</li>
  89. <span>{{.i18n.Tr "admin.auths.tip.bitbucket"}}</span>
  90. <li>Dropbox</li>
  91. <span>{{.i18n.Tr "admin.auths.tip.dropbox"}}</span>
  92. <li>Facebook</li>
  93. <span>{{.i18n.Tr "admin.auths.tip.facebook"}}</span>
  94. <li>GitHub</li>
  95. <span>{{.i18n.Tr "admin.auths.tip.github"}}</span>
  96. <li>GitLab</li>
  97. <span>{{.i18n.Tr "admin.auths.tip.gitlab"}}</span>
  98. <li>Google</li>
  99. <span>{{.i18n.Tr "admin.auths.tip.google_plus"}}</span>
  100. <li>OpenID Connect</li>
  101. <span>{{.i18n.Tr "admin.auths.tip.openid_connect"}}</span>
  102. <li>Twitter</li>
  103. <span>{{.i18n.Tr "admin.auths.tip.twitter"}}</span>
  104. <li>Discord</li>
  105. <span>{{.i18n.Tr "admin.auths.tip.discord"}}</span>
  106. <li>Gitea</li>
  107. <span>{{.i18n.Tr "admin.auths.tip.gitea"}}</span>
  108. <li>Nextcloud</li>
  109. <span>{{.i18n.Tr "admin.auths.tip.nextcloud"}}</span>
  110. <li>Yandex</li>
  111. <span>{{.i18n.Tr "admin.auths.tip.yandex"}}</span>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. {{template "base/footer" .}}