auth

Paddy 2014-08-16 Parent:244ac84003b3 Child:9fe684b33b3d

15:fc5df8e68c7b Go to Latest

auth/access.go

Render results. Render JSON tokens and errors. Render HTML errors, confirmation, and login pages.

History
     1.1 --- a/access.go	Sat Aug 16 02:57:49 2014 -0400
     1.2 +++ b/access.go	Sat Aug 16 05:33:23 2014 -0400
     1.3 @@ -21,15 +21,16 @@
     1.4  
     1.5  // AccessData represents an access grant (tokens, expiration, client, etc)
     1.6  type AccessData struct {
     1.7 -	PreviousAuthorizeData *AuthorizeData
     1.8 -	PreviousAccessData    *AccessData // previous access data, when refreshing
     1.9 -	AccessToken           string
    1.10 -	RefreshToken          string
    1.11 -	ExpiresIn             int32
    1.12 -	CreatedAt             time.Time
    1.13 -	TokenType             string
    1.14 -	ProfileID             uuid.ID
    1.15 -	AuthRequest
    1.16 +	PreviousAuthorizeData *AuthorizeData `json:"-"`
    1.17 +	PreviousAccessData    *AccessData    `json:"-"` // previous access data, when refreshing
    1.18 +	AccessToken           string         `json:"access_token"`
    1.19 +	RefreshToken          string         `json:"refresh_token,omitempty"`
    1.20 +	ExpiresIn             int32          `json:"expires_in"`
    1.21 +	CreatedAt             time.Time      `json:"-"`
    1.22 +	TokenType             string         `json:"token_type"`
    1.23 +	Scope                 string         `json:"scope,omitempty"`
    1.24 +	ProfileID             uuid.ID        `json:"-"`
    1.25 +	AuthRequest           `json:"-"`
    1.26  }
    1.27  
    1.28  // IsExpired returns true if access expired
    1.29 @@ -141,6 +142,7 @@
    1.30  			RedirectURI: redirectURI,
    1.31  			Scope:       authData.Scope,
    1.32  		},
    1.33 +		Scope: authData.Scope,
    1.34  		PreviousAuthorizeData: &authData,
    1.35  	}
    1.36  
    1.37 @@ -207,6 +209,7 @@
    1.38  			Client: client,
    1.39  			Scope:  scope,
    1.40  		},
    1.41 +		Scope:              scope,
    1.42  		PreviousAccessData: &refreshData,
    1.43  	}
    1.44  	err = fillTokens(&data, true, ctx)
    1.45 @@ -261,6 +264,7 @@
    1.46  			Client: client,
    1.47  			Scope:  scope,
    1.48  		},
    1.49 +		Scope: scope,
    1.50  	}
    1.51  
    1.52  	err = fillTokens(&data, true, ctx)
    1.53 @@ -297,6 +301,7 @@
    1.54  			Client: client,
    1.55  			Scope:  scope,
    1.56  		},
    1.57 +		Scope: scope,
    1.58  	}
    1.59  
    1.60  	err = fillTokens(&data, true, ctx)