Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 1,162 for beaver (0.31 sec)

  1. tests/test_security_api_key_header.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyHeader(name="key")
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str = Security(api_key)):
        user = User(username=oauth_header)
        return user
    
    
    @app.get("/users/me")
    def read_current_user(current_user: User = Depends(get_current_user)):
        return current_user
    
    
    client = TestClient(app)
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/base/Function.java

       * <i>May</i> return {@code true} if {@code object} is a {@code Function} that behaves identically
       * to this function.
       *
       * <p><b>Warning: do not depend</b> on the behavior of this method.
       *
       * <p>Historically, {@code Function} instances in this library have implemented this method to
       * recognize certain cases where distinct {@code Function} instances would in fact behave
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Apr 24 01:41:50 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  3. fastapi/security/oauth2.py

            return authorization
    
    
    class OAuth2PasswordBearer(OAuth2):
        """
        OAuth2 flow for authentication using a bearer token obtained with a password.
        An instance of it would be used as a dependency.
    
        Read more about it in the
        [FastAPI docs for Simple OAuth2 with Password and Bearer](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/).
        """
    
        def __init__(
            self,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  4. tests/test_security_oauth2_password_bearer_optional.py

        assert response.status_code == 200, response.text
        assert response.json() == {"msg": "Create an account first"}
    
    
    def test_token():
        response = client.get("/items", headers={"Authorization": "Bearer testtoken"})
        assert response.status_code == 200, response.text
        assert response.json() == {"token": "testtoken"}
    
    
    def test_incorrect_token():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/cors.md

    But that will only allow certain types of communication, excluding everything that involves credentials: Cookies, Authorization headers like those used with Bearer Tokens, etc.
    
    So, for everything to work correctly, it's better to specify explicitly the allowed origins.
    
    ## Use `CORSMiddleware`
    
    You can configure it in your **FastAPI** application using the `CORSMiddleware`.
    
    * Import `CORSMiddleware`.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Nov 13 20:28:37 GMT 2022
    - 5.1K bytes
    - Viewed (0)
  6. cmd/bootstrap-peer-server_gen.go

    package cmd
    
    // Code generated by github.com/tinylib/msgp DO NOT EDIT.
    
    import (
    	"github.com/tinylib/msgp/msgp"
    )
    
    // DecodeMsg implements msgp.Decodable
    func (z *ServerSystemConfig) DecodeMsg(dc *msgp.Reader) (err error) {
    	var field []byte
    	_ = field
    	var zb0001 uint32
    	zb0001, err = dc.ReadMapHeader()
    	if err != nil {
    		err = msgp.WrapError(err)
    		return
    	}
    	for zb0001 > 0 {
    		zb0001--
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Wed Jan 24 21:36:44 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  7. cmd/storage-rest-server.go

    // has been used.
    // The returned reader contains the payload.
    func waitForHTTPResponse(respBody io.Reader) (io.Reader, error) {
    	reader := bufio.NewReader(respBody)
    	for {
    		b, err := reader.ReadByte()
    		if err != nil {
    			return nil, err
    		}
    		// Check if we have a response ready or a filler byte.
    		switch b {
    		case 0:
    			return reader, nil
    		case 1:
    			errorText, err := io.ReadAll(reader)
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 44.8K bytes
    - Viewed (0)
  8. docs/pt/docs/tutorial/security/first-steps.md

    		* Mas precisa de autenticação para aquele endpoint em específico.
    		* Então, para autenticar com nossa API, ele manda um header de `Autorização` com o valor `Bearer` mais o token.
    		* Se o token contém `foobar`, o conteúdo do header de `Autorização` será: `Bearer foobar`.
    
    ## **FastAPI**'s `OAuth2PasswordBearer`
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  9. internal/config/lambda/target/webhook.go

    	// already present we can blindly use the
    	// authToken as is instead of adding 'Bearer'
    	tokens := strings.Fields(target.args.AuthToken)
    	switch len(tokens) {
    	case 2:
    		req.Header.Set("Authorization", target.args.AuthToken)
    	case 1:
    		req.Header.Set("Authorization", "Bearer "+target.args.AuthToken)
    	}
    
    	req.Header.Set("Content-Type", "application/json")
    
    	return target.httpClient.Do(req)
    }
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Nov 17 20:02:26 GMT 2023
    - 6.7K bytes
    - Viewed (0)
  10. tests/test_security_api_key_header_description.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyHeader(name="key", description="An API Key Header")
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str = Security(api_key)):
        user = User(username=oauth_header)
        return user
    
    
    @app.get("/users/me")
    def read_current_user(current_user: User = Depends(get_current_user)):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2K bytes
    - Viewed (0)
Back to top