-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional OAuth2 providers #1010
Conversation
build failed. |
fixed |
models/login_source.go
Outdated
@@ -23,6 +23,7 @@ import ( | |||
"code.gitea.io/gitea/modules/auth/pam" | |||
"code.gitea.io/gitea/modules/log" | |||
"code.gitea.io/gitea/modules/auth/oauth2" | |||
"sort" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move local package to top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, changed to goimports style
modules/auth/oauth2/oauth2.go
Outdated
"github.com/markbates/goth/providers/facebook" | ||
"github.com/markbates/goth/providers/dropbox" | ||
"github.com/markbates/goth/providers/openidConnect" | ||
"math" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, changed to goimports style
@willemvd build fails |
Build failure over a file I didn't change and cannot be found at that location? 😕 |
Not sure what happend , but rebase seems to have messed up my PR |
|
Will that work even in this broken state? |
…hile building cross platform (and disk overflow)
acc2097
to
8b8b5f4
Compare
@lunny created a new branch of upstream/master and cherry-picked the commits on top of it, after git push --force it seems to be ok now 😄 |
models/error.go
Outdated
// / | \/ | \ | / | | \ Y / | ||
// \_______ /\____|__ /______/ |____| \___|_ / | ||
// \/ \/ \/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could take the chance to start with splitting error.go into error_oauth.go ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done , also moved some stuff from login_source.go to oauth2.go
…ly these could have a different host)
_, err := x.Id(source.ID).AllCols().Update(source) | ||
if err == nil && source.IsOAuth2() { | ||
if err == nil && source.IsOAuth2() && source.IsActived { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling: source.IsActive , this needs to be renamed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reuse of existing code, so I think out of scope for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not only that, it's also in a DB model so changing that field would require a migration :/
}, | ||
"gplus": {Name: "gplus", DisplayName: "Google+", Image: "/img/auth/google_plus.png"}, | ||
"openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/img/auth/openid_connect.png"}, | ||
"twitter": {Name: "twitter", DisplayName: "Twitter", Image: "/img/auth/twitter.png"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add stack exchange as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this is not yet available in https://github.com/markbates/goth/#supported-providers or is it named differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the record; stackexchange (also?) supports OpenID-2.0, and you can use openid.stackexchange.com
to login (will be converted to actual URL upon logging in)
templates/admin/auth/new.tmpl
Outdated
{{.i18n.Tr "admin.auths.tips"}} | ||
</h4> | ||
<div class="ui attached segment"> | ||
<h5>GMail Settings:</h5> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gmail, not GMail. Maybe also add this to translations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reuse of existing code, so I think out of scope for this PR
templates/admin/auth/new.tmpl
Outdated
<span>{{.i18n.Tr "admin.auths.tip.twitter"}}</span> | ||
</div> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to make this automated (maybe a loop)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will have a look if this can be a loop over the existing OAuth2 providers
# Conflicts: # routers/user/auth.go # templates/user/auth/signin_inner.tmpl
@willemvd is this ready to review? |
@lunny yes it is, unfortunately the last push didn't triggered a drone build so maybe you can manually trigger this (or I could do a merge/rebase with master) |
@willemvd please send a rebase, I cannot find the link to the drone build. |
@lunny drone is almost done without failures, so it is ready! 😄 |
I have tested |
Are we allowed to use these logos? Why not use the ones in FontAwesome? (Edit: I know for a fact that GitLab is missing from FA...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
routers/admin/auths.go
Outdated
"code.gitea.io/gitea/modules/base" | ||
"code.gitea.io/gitea/modules/context" | ||
"code.gitea.io/gitea/modules/log" | ||
"code.gitea.io/gitea/modules/setting" | ||
"github.com/Unknwon/com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline before external packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
templates/admin/auth/edit.tmpl
Outdated
{{range $key, $value := .OAuth2Providers}} | ||
<div class="item" data-value="{{$key}}">{{$value.DisplayName}}</div> | ||
{{end}} | ||
<!-- OAuth2 --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Build seems to failed because the vendor |
Didnt change anything to that lib so not sure why this happened, but I have updated the lib |
LGTM |
This is a followup on #679 (this PR is based on the merged #679 master) which only included GitHub as an OAuth2 provider.
For now the following providers are implemented (incl signin image and tip text in admin/auths/new):
Google+
GitLab
Bitbucket
Twitter
Facebook
Dropbox
OpenID Connect
For GitLab and Github it is now possible to change the default urls to custom urls, this means you can connect them to your own private/local/on-premise/enterprise installation
I will add and test new providers on request in this PR (or on gitter?), list of possible providers can be found at : https://github.com/markbates/goth/#supported-providers