How to Respond to an Authentication Challenge | iOS

How to Respond to an Authentication Challenge

If a session requires authentication it creates authentication challenge

 URLSession:task:didReceiveChallenge:completionHandler: 

in order for the connection to continue, the delegate has three options.

  • Provide authentication credentials
  • Attempt to continue without credentails
  • Cancel the authentication request.

NSURLProtectionSpace will give all information about the authentication type and failure if any attempts failed earlier.

Providing Credentials

To attempt to authenticate, the application should create an NSURLCredential object with authentication information of the form expected by the server. You can determine the server’s authentication method by calling authenticationMethod on the protection space.

  • HTTP basic authentication (NSURLAuthenticationMethodHTTPBasic) requires a user name and password. P
  • HTTP digest authentication (NSURLAuthenticationMethodHTTPDigest), like basic authentication, requires a user name and password.withcredentialWithUser:password:persistence:.
  • Client certificate authentication (NSURLAuthenticationMethodClientCertificate) requires the system identity and all certificates needed to authenticate with the server. Create an NSURLCredential object.
  • Server trust authentication (NSURLAuthenticationMethodServerTrust) requires a trust provided by the protection space of the authentication challenge.

Continuing Without Credentials

If the delegate chooses not to provide a credential for the authentication challenge, it can attempt to continue without one.

NSURLSessionAuthChallengePerformDefaultHandling processes the request as though the delegate did not provide a delegate method to handle the challenge.

  • NSURLSessionAuthChallengeRejectProtectionSpace rejects the challenge. Depending on the authentication types allowed by the server’s response, the URL loading class may call this delegate method more than once, for additional protection spaces.

Canceling the Connection

The delegate may also choose to cancel the authentication challenge, by passing NSURLSessionAuthChallengeCancelAuthenticationChallenge to the provided completion handler block.

10 Ways To Make People Like You | Quick Notes

Currently I am reading one of the best book ever by Dale Carnegie – How to win friends and influence people and decided to share beautiful things that I found as quick notes. 

  • Become genuinely interested in other people, the only way to make genuine and long lasting friendship is to show interested and give respect to others.
  • Always smile, Smiles are free to give and have an amazing ability to make others feel wonderful.
  • Remember the person’s name, because people love there names.
  • Good listener, listen to them always maintain 80-20 principle (listen 80% and talk 20%).
  • Make other people feel important, give equal response to everyone. The golden rule is to treat other people how we would like to be treated.
  • Avoid the argument, because it does not matter if you win or lose as we always lose.
  • Never ever say you’re wrong better ask questions to them, so that they can realize it better.
  • If you’re wrong admit it quickly.
  • Call attention to people mistakes indirectly, no one likes to make mistake so scolding and blaming them only serves humiliate. Listen, share and discuss they will appreciate.
  • Talk about your mistakes before criticizing others.

Thanks for reading.

10 Ways To Make People Like You | Quick Notes

Currently, I am reading one of the best books ever by Dale Carnegie – How to win friends and influence people and decided to share beautiful things that I found as quick notes.

  • Become genuinely interested in other people, the only way to make genuine and long lasting friendship is to show interesting and give respect to others.
  • Always smile, Smiles are free to give and have an amazing ability to make others feel wonderful.
  • Remember the person’s name, because people love their names.
  • Good listener, listen to them always maintain 80-20 principle (listen 80% and talk 20%).
  • Make other people feel important, give the equal response to everyone. The golden rule is to treat other people how we would like to be treated.
  • Avoid the argument, because it does not matter if you win or lose as we always lose.
  • Never ever say you’re wrong better ask questions to them so that they can realize it better.
  • If you wrong admit it quickly.
  • Call attention to people mistakes indirectly, no one likes to make mistake so scolding and blaming them only serve to humiliate. Listen, share and discuss they will appreciate.
  • Talk about your mistakes before criticizing others.

Thank you for reading! If you really want to read more please share your feedback it will help a lot and it will be appreciated.

 

Fundamentals Technique for Handling Peoples | Quick Notes

Handling people is one of the biggest deal, because different peoples different views so for making long lasting relationships in personal or professional we need to add few things. Today I was learning new book `How to win friends and influence people by ` so sharing quick note here.

Fundamentals Technique for Handling Peoples.

  1. Don’t Criticize or Complain

Human nature does not like to admit fault, when people are criticized they rarely response you well so never ever criticize or complain because it will never result in the behavior what we want.

  1. Give Honest Appreciation

when it comes to appreciation, it’s the powerful key to win heart. Honest appreciation brings out their best and it must be sincere, meaningful and with love.

  1. Listen to them

To get what we want from other people we have to first listen them careful and see things from the point of view of others. So if you are a better listener it will already solve lots of conflicts.

  1. Mutually Achievement

So follow the 3rd point and then we can combine our desires with their wants after that they will become eager to work with you, now you can mutually achieve out objectives.

Thank you for reading! If you really want to read more please share your feedback it will help a lot and it will be appreciated.