Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access token connection #230

Merged
merged 7 commits into from Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions RMQClient.xcodeproj/project.pbxproj
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1029A0E22087A97E00C72924 /* ConnectionDeadlockTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1029A0E12087A97E00C72924 /* ConnectionDeadlockTests.swift */; };
4DF6E46D27F6E98100C43208 /* RMQClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEE7FE911C3BCA6000DF8C4F /* RMQClient.framework */; };
5CE0C5292B873842000087B7 /* ConnectionUpdateSecretTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CE0C5282B873842000087B7 /* ConnectionUpdateSecretTest.swift */; };
70311B0B21ED538600AE1804 /* RMQConnectionDefaults.h in Headers */ = {isa = PBXBuildFile; fileRef = 70311B0A21ED538600AE1804 /* RMQConnectionDefaults.h */; };
70338A2421FBAA7C00C9069D /* TLSConnectionIntegrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70338A2321FBAA7C00C9069D /* TLSConnectionIntegrationTest.swift */; };
705359A921D174A400CF6456 /* TestCertificates in Resources */ = {isa = PBXBuildFile; fileRef = 705359A821D174A400CF6456 /* TestCertificates */; };
Expand Down Expand Up @@ -238,6 +239,7 @@
/* Begin PBXFileReference section */
1029A0E12087A97E00C72924 /* ConnectionDeadlockTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionDeadlockTests.swift; sourceTree = "<group>"; };
4DF6E43627F6E90700C43208 /* MemoryTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MemoryTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
5CE0C5282B873842000087B7 /* ConnectionUpdateSecretTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionUpdateSecretTest.swift; sourceTree = "<group>"; };
70311B0A21ED538600AE1804 /* RMQConnectionDefaults.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RMQConnectionDefaults.h; sourceTree = "<group>"; };
70338A2321FBAA7C00C9069D /* TLSConnectionIntegrationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TLSConnectionIntegrationTest.swift; sourceTree = "<group>"; };
705359A821D174A400CF6456 /* TestCertificates */ = {isa = PBXFileReference; lastKnownFileType = folder; path = TestCertificates; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -491,6 +493,7 @@
AE26FA2F1C970E9A00CDBBAA /* Channels */ = {
isa = PBXGroup;
children = (
5CE0C5282B873842000087B7 /* ConnectionUpdateSecretTest.swift */,
AE26FA2D1C970DF100CDBBAA /* RMQChannelContract.swift */,
AE8279841C8D86110013ADD1 /* ChannelAllocationTest.swift */,
AE8AD2681CC545ED00229444 /* RMQFramesetValidatorTest.swift */,
Expand Down Expand Up @@ -1292,6 +1295,7 @@
AE9DB00D1D12AA120005F44B /* RMQTransactionalConfirmationsTest.swift in Sources */,
AE11F1B21D155C8A007AD330 /* RMQMessageTest.swift in Sources */,
AE9DB0091D11FDED0005F44B /* ConfirmationsSpy.swift in Sources */,
5CE0C5292B873842000087B7 /* ConnectionUpdateSecretTest.swift in Sources */,
AEA8A7621CC97C7900371E38 /* RMQGCDSerialQueueTest.swift in Sources */,
AE59345B1C8735FA00560A73 /* ChannelSpy.swift in Sources */,
AE8AD25C1CC4E67F00229444 /* RMQUnallocatedChannelTest.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQAllocatedChannel.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RabbitMQ has changed its license to MPL 2.0 years ago. If this is not reflected somewhere in this client, it should be updated but in a separate PR. Please back out all license header changes.

//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQAllocatedChannel.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQBasicProperties+MergeDefaults.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQBasicProperties+MergeDefaults.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
42 changes: 41 additions & 1 deletion RMQClient/RMQBasicProperties.h
@@ -1,4 +1,44 @@
// License goes here
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 1.1 and the Apache License ("ASL"), version 2.0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, the license of open source RabbitMQ and its clients is now MPL 2.0 (plus usually at least one other license for client libraries).

//
// The ASL v2.0:
//
// ---------------------------------------------------------------------------
// Copyright 2017-2022 VMware, Inc. or its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ---------------------------------------------------------------------------
//
// The MPL v2.0:
//
// ---------------------------------------------------------------------------
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2007-2022 VMware, Inc. or its affiliates. All rights reserved.
//
// Alternatively, the contents of this file may be used under the terms
// of the Apache Standard license (the "ASL License"), in which case the
// provisions of the ASL License are applicable instead of those
// above. If you wish to allow use of your version of this file only
// under the terms of the ASL License and not to allow others to use
// your version of this file under the MPL, indicate your decision by
// deleting the provisions above and replace them with the notice and
// other provisions required by the ASL License. If you do not delete
// the provisions above, a recipient may use your version of this file
// under either the MPL or the ASL License.
// ---------------------------------------------------------------------------

// This file is generated. Do not edit.
#import "RMQTable.h"
Expand Down
42 changes: 41 additions & 1 deletion RMQClient/RMQBasicProperties.m
@@ -1,4 +1,44 @@
// License goes here
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
// ---------------------------------------------------------------------------
// Copyright 2017-2022 VMware, Inc. or its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ---------------------------------------------------------------------------
//
// The MPL v2.0:
//
// ---------------------------------------------------------------------------
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2007-2022 VMware, Inc. or its affiliates. All rights reserved.
//
// Alternatively, the contents of this file may be used under the terms
// of the Apache Standard license (the "ASL License"), in which case the
// provisions of the ASL License are applicable instead of those
// above. If you wish to allow use of your version of this file only
// under the terms of the ASL License and not to allow others to use
// your version of this file under the MPL, indicate your decision by
// deleting the provisions above and replace them with the notice and
// other provisions required by the ASL License. If you do not delete
// the provisions above, a recipient may use your version of this file
// under either the MPL or the ASL License.
// ---------------------------------------------------------------------------

// This file is generated. Do not edit.
#import "RMQBasicProperties.h"
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQChannel.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQChannelAllocator.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQClient.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQClock.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConfirmationTransaction.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConfirmationTransaction.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConfirmations.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
12 changes: 11 additions & 1 deletion RMQClient/RMQConnection.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down Expand Up @@ -242,4 +242,14 @@
*/
- (nonnull id<RMQChannel>)createChannel;

/*!
* @brief Update secret.
* This method updates the secret used to authenticate this connection.
* It is used when secrets have an expiration date and need to be renewed, like OAuth 2 tokens.
* @param secret The new secret.
* @param reason The reason for the secret update.
*/
- (void)updateSecret:(nonnull NSString *)secret
reason:(nonnull NSString *)reason;

@end
18 changes: 17 additions & 1 deletion RMQClient/RMQConnection.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down Expand Up @@ -608,6 +608,14 @@ - (void)start {
return ch;
}

- (void)updateSecret:(NSString *)secret
reason:(NSString *)reason
{
[self.commandQueue enqueue:^{
[self sendFrameset:[[RMQFrameset alloc] initWithChannelNumber:@0 method:[self methodForUpdateSecret:secret reason:reason]]];
}];
}

- (BOOL)hasCompletedHandshake {
return self.handshakeComplete;
}
Expand Down Expand Up @@ -746,6 +754,14 @@ - (void)closeAllUserChannels {
}
}

- (RMQConnectionUpdateSecret *)methodForUpdateSecret:(NSString *)secret
reason:(NSString *)reason {
RMQLongstr *secretLongstr = [[RMQLongstr alloc] init:secret];
RMQShortstr *reasonShortstr = [[RMQShortstr alloc] init:reason];
return [[RMQConnectionUpdateSecret alloc] initWithSecret:secretLongstr
reason:reasonShortstr];
}

- (RMQConnectionClose *)amqClose {
return [[RMQConnectionClose alloc] initWithReplyCode:[[RMQShort alloc] init:200]
replyText:[[RMQShortstr alloc] init:@"Goodbye"]
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionConfig.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionConfig.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionDefaults.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionDelegate.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionDelegateLogger.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionDelegateLogger.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionRecover.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionRecover.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConnectionRecovery.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConsumer.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConsumer.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQConsumerHandlers.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQDispatcher.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQErrors.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQErrors.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQExchange.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQExchange.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQFrame.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQFrame.m
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down
2 changes: 1 addition & 1 deletion RMQClient/RMQFrameHandler.h
@@ -1,5 +1,5 @@
// This source code is dual-licensed under the Mozilla Public License ("MPL"),
// version 2.0 and the Apache License ("ASL"), version 2.0.
// version 1.1 and the Apache License ("ASL"), version 2.0.
//
// The ASL v2.0:
//
Expand Down