@@ -5,7 +5,6 @@ package auth
55
66import (
77 "net/http"
8- "reflect"
98 "strings"
109
1110 user_model "code.gitea.io/gitea/models/user"
@@ -37,21 +36,16 @@ func (b *Group) Add(method Method) {
3736func (b * Group ) Name () string {
3837 names := make ([]string , 0 , len (b .methods ))
3938 for _ , m := range b .methods {
40- if n , ok := m .(Named ); ok {
41- names = append (names , n .Name ())
42- } else {
43- names = append (names , reflect .TypeOf (m ).Elem ().Name ())
44- }
39+ names = append (names , m .Name ())
4540 }
4641 return strings .Join (names , "," )
4742}
4843
49- // Verify extracts and validates
5044func (b * Group ) Verify (req * http.Request , w http.ResponseWriter , store DataStore , sess SessionStore ) (* user_model.User , error ) {
5145 // Try to sign in with each of the enabled plugins
5246 var retErr error
53- for _ , ssoMethod := range b .methods {
54- user , err := ssoMethod .Verify (req , w , store , sess )
47+ for _ , m := range b .methods {
48+ user , err := m .Verify (req , w , store , sess )
5549 if err != nil {
5650 if retErr == nil {
5751 retErr = err
@@ -67,9 +61,7 @@ func (b *Group) Verify(req *http.Request, w http.ResponseWriter, store DataStore
6761 // Return the user and ignore any error returned by previous methods.
6862 if user != nil {
6963 if store .GetData ()["AuthedMethod" ] == nil {
70- if named , ok := ssoMethod .(Named ); ok {
71- store .GetData ()["AuthedMethod" ] = named .Name ()
72- }
64+ store .GetData ()["AuthedMethod" ] = m .Name ()
7365 }
7466 return user , nil
7567 }
0 commit comments