File tree 1 file changed +17
-7
lines changed
Owncloud iOs Client/Login/Login
1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -1989,23 +1989,32 @@ - (void) checkIfServerAutentificationIsNormalFromURL {
1989
1989
});
1990
1990
} failureRequest: ^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
1991
1991
1992
- BOOL isInvalid = NO ;
1992
+ BOOL isInvalid = YES ;
1993
+
1994
+ NSString *authenticationHeader = @" Www-Authenticate" ;
1995
+ NSString *outhAuthentication = @" bearer" ;
1996
+ NSString *basicAuthentication = @" basic" ;
1993
1997
1994
1998
if (!k_is_sso_active) {
1995
- // Get header related with autentication type
1996
- NSString *autenticationType = [[response allHeaderFields ] valueForKey: @" Www-Authenticate" ];
1997
-
1998
- if ((autenticationType) && ([autenticationType hasPrefix: @" Bearer" ])) {
1999
+ if (response.statusCode == kOCErrorServerUnauthorized ) {
2000
+ // Get header related with autentication type
2001
+ NSString *autenticationType = [[response allHeaderFields ] valueForKey: authenticationHeader];
2002
+
2003
+ if ((autenticationType) && ([autenticationType.lowercaseString hasPrefix: outhAuthentication])) {
1999
2004
// Autentication type oauth
2000
2005
if (k_is_oauth_active) {
2001
2006
// Check if is activate oauth
2002
2007
isInvalid = NO ;
2003
2008
} else {
2004
2009
isInvalid = YES ;
2005
2010
}
2006
- } else {
2007
- // Unknown autentication type
2011
+ } else if ((autenticationType) && ([autenticationType.lowercaseString hasPrefix: basicAuthentication])) {
2008
2012
isInvalid = NO ;
2013
+ } else {
2014
+ // For the moment we have to mantain this value as valid because when we work with
2015
+ // some Redirected Server our library lost the Wwww-Authenticate header
2016
+ isInvalid = NO ;
2017
+ }
2009
2018
}
2010
2019
2011
2020
} else {
@@ -2015,6 +2024,7 @@ - (void) checkIfServerAutentificationIsNormalFromURL {
2015
2024
isLoginButtonEnabled = YES ;
2016
2025
}
2017
2026
2027
+
2018
2028
// Update the interface depend of if isInvalid or not
2019
2029
if (isInvalid) {
2020
2030
hasInvalidAuth = YES ;
You can’t perform that action at this time.
0 commit comments