-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from wultra/develop
Prepare release 1.3.0
- Loading branch information
Showing
15 changed files
with
542 additions
and
113 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...n/java/io/getlime/security/powerauth/lib/cmd/header/TokenAndEncryptionHeaderProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* PowerAuth Command-line utility | ||
* Copyright 2022 Wultra s.r.o. | ||
* | ||
* 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 | ||
* | ||
* http://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. | ||
*/ | ||
package io.getlime.security.powerauth.lib.cmd.header; | ||
|
||
import io.getlime.security.powerauth.lib.cmd.steps.context.StepContext; | ||
import io.getlime.security.powerauth.lib.cmd.steps.model.data.EncryptionHeaderData; | ||
import io.getlime.security.powerauth.lib.cmd.steps.model.data.TokenAndEncryptionHeaderData; | ||
import io.getlime.security.powerauth.lib.cmd.steps.model.data.TokenHeaderData; | ||
|
||
import static io.getlime.security.powerauth.lib.cmd.consts.BackwardCompatibilityConst.POWER_AUTH_HEADER_FACTORY; | ||
|
||
/** | ||
* Token and encryption header provider. | ||
* | ||
* @author Roman Strobl, [email protected] | ||
*/ | ||
public class TokenAndEncryptionHeaderProvider implements PowerAuthHeaderProvider<TokenAndEncryptionHeaderData> { | ||
|
||
/** | ||
* Adds a token and encryption headers to the request context | ||
* @param stepContext Step context | ||
*/ | ||
@Override | ||
public void addHeader(StepContext<? extends TokenAndEncryptionHeaderData, ?> stepContext) throws Exception { | ||
TokenHeaderData tokenHeaderData = stepContext.getModel(); | ||
POWER_AUTH_HEADER_FACTORY.getHeaderProvider(tokenHeaderData).addHeader(stepContext); | ||
EncryptionHeaderData encryptionHeaderData = stepContext.getModel(); | ||
POWER_AUTH_HEADER_FACTORY.getHeaderProvider(encryptionHeaderData).addHeader(stepContext); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...main/java/io/getlime/security/powerauth/lib/cmd/steps/model/TokenAndEncryptStepModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* PowerAuth Command-line utility | ||
* Copyright 2022 Wultra s.r.o. | ||
* | ||
* 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 | ||
* | ||
* http://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. | ||
*/ | ||
package io.getlime.security.powerauth.lib.cmd.steps.model; | ||
|
||
import io.getlime.security.powerauth.lib.cmd.steps.model.data.TokenAndEncryptionHeaderData; | ||
import io.getlime.security.powerauth.lib.cmd.steps.model.feature.DryRunCapable; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Model representing parameters of the step for verifying token digest. | ||
* | ||
* @author Petr Dvorak, [email protected] | ||
*/ | ||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
public class TokenAndEncryptStepModel extends BaseStepModel | ||
implements DryRunCapable, TokenAndEncryptionHeaderData { | ||
|
||
/** | ||
* Token ID. | ||
*/ | ||
private String tokenId; | ||
|
||
/** | ||
* Token secret. | ||
*/ | ||
private String tokenSecret; | ||
|
||
/** | ||
* HTTP method. | ||
*/ | ||
private String httpMethod; | ||
|
||
/** | ||
* HTTP request data. | ||
*/ | ||
private byte[] data; | ||
|
||
/** | ||
* Application key. | ||
*/ | ||
private String applicationKey; | ||
|
||
/** | ||
* Application secret. | ||
*/ | ||
private String applicationSecret; | ||
|
||
/** | ||
* Flag indicating that this step should be terminated before the networking call. | ||
*/ | ||
private boolean dryRun; | ||
|
||
@Override | ||
public Map<String, Object> toMap() { | ||
Map<String, Object> context = super.toMap(); | ||
context.put("TOKEN_ID", tokenId); | ||
context.put("TOKEN_SECRET", tokenSecret); | ||
context.put("APPLICATION_KEY", applicationKey); | ||
context.put("APPLICATION_SECRET", applicationSecret); | ||
context.put("HTTP_METHOD", httpMethod); | ||
context.put("DATA", data); | ||
context.put("DRY_RUN", dryRun); | ||
return context; | ||
} | ||
|
||
@Override | ||
public void fromMap(Map<String, Object> context) { | ||
super.fromMap(context); | ||
setTokenId((String) context.get("TOKEN_ID")); | ||
setTokenSecret((String) context.get("TOKEN_SECRET")); | ||
setApplicationKey((String) context.get("APPLICATION_KEY")); | ||
setApplicationSecret((String) context.get("APPLICATION_SECRET")); | ||
setHttpMethod((String) context.get("HTTP_METHOD")); | ||
setData((byte[]) context.get("DATA")); | ||
setDryRun((boolean) context.get("DRY_RUN")); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
.../io/getlime/security/powerauth/lib/cmd/steps/model/data/TokenAndEncryptionHeaderData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* PowerAuth Command-line utility | ||
* Copyright 2022 Wultra s.r.o. | ||
* | ||
* 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 | ||
* | ||
* http://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. | ||
*/ | ||
package io.getlime.security.powerauth.lib.cmd.steps.model.data; | ||
|
||
/** | ||
* Data used for computing a token and encryption header values. | ||
* | ||
* @author Roman Strobl, [email protected] | ||
*/ | ||
public interface TokenAndEncryptionHeaderData extends TokenHeaderData, EncryptionHeaderData { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.