private HttpResponseMessage ProcessAuthorizationCodeRequest(ValidatedRequest validatedRequest)
        {
            Tracing.Information("Processing authorization code request");

            var tokenService = new OidcTokenService(
                ServerConfiguration.Global.IssuerUri,
                ServerConfiguration.Keys.SigningCertificate);

            var response = tokenService.CreateTokenResponse(validatedRequest.Grant,
                                                            validatedRequest.Client.AccessTokenLifetime);

            Grants.Delete(validatedRequest.Grant.GrantId);

            if (validatedRequest.Grant.Scopes.Contains(OidcConstants.Scopes.OfflineAccess) &&
                validatedRequest.Client.AllowRefreshToken)
            {
                var refreshToken = StoredGrant.CreateRefreshToken(
                    validatedRequest.Grant.ClientId,
                    validatedRequest.Grant.Subject,
                    validatedRequest.Grant.Scopes,
                    validatedRequest.Client.RefreshTokenLifetime);

                Grants.Add(refreshToken);
                response.RefreshToken = refreshToken.GrantId;
            }

            return(Request.CreateTokenResponse(response));
        }
        /// <summary>
        /// Creates a S3Grant and adds it to the list of grants.
        /// </summary>
        /// <param name="grantee">The grantee for the grant.</param>
        /// <param name="permission">The permission for the grantee.</param>
        public void AddGrant(S3Grantee grantee, S3Permission permission)
        {
            S3Grant grant = new S3Grant {
                Grantee = grantee, Permission = permission
            };

            Grants.Add(grant);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a S3Grant and adds it to the list of grants.
        /// </summary>
        /// <param name="grantee">The grantee for the grant.</param>
        /// <param name="permission">The permission for the grantee.</param>
        public void AddGrant(S3Grantee grantee, S3Permission permission)
        {
            S3Grant grant = new S3Grant();

            grant.WithGrantee(grantee);
            grant.WithPermission(permission);
            Grants.Add(grant);
        }
Exemplo n.º 4
0
        public void AddGrant(S3Grantee grantee, S3Permission permission)
        {
            S3Grant item = new S3Grant
            {
                Grantee    = grantee,
                Permission = permission
            };

            Grants.Add(item);
        }
Exemplo n.º 5
0
 public PermChecker(NodeInfo checkThis, List <Perm> perms)
 {
     Seeking = checkThis;
     foreach (var p in perms)
     {
         if (p.Type == PermType.Allow)
         {
             Allows.Add(p);
         }
         else if (p.Type == PermType.Deny)
         {
             Denies.Add(p);
         }
         else
         {
             Grants.Add(p);
         }
     }
 }