CompleteAuth marks the provided path or URL (containing "/auth/...") as successfully authenticated, unblocking any requests blocked on that in serveRegister.
(authPathOrURL string)
| 761 | // "/auth/...") as successfully authenticated, unblocking any |
| 762 | // requests blocked on that in serveRegister. |
| 763 | func (s *Server) CompleteAuth(authPathOrURL string) bool { |
| 764 | i := strings.Index(authPathOrURL, "/auth/") |
| 765 | if i == -1 { |
| 766 | return false |
| 767 | } |
| 768 | authPath := authPathOrURL[i:] |
| 769 | |
| 770 | s.mu.Lock() |
| 771 | defer s.mu.Unlock() |
| 772 | ap, ok := s.authPath[authPath] |
| 773 | if !ok { |
| 774 | return false |
| 775 | } |
| 776 | if ap.nodeKey.IsZero() { |
| 777 | panic("zero AuthPath.NodeKey") |
| 778 | } |
| 779 | s.nodeKeyAuthed.Make() |
| 780 | s.nodeKeyAuthed.Add(ap.nodeKey) |
| 781 | ap.CompleteSuccessfully() |
| 782 | return true |
| 783 | } |
| 784 | |
| 785 | // Complete the device approval for this node. |
| 786 | // |