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

CXF-8121 Improve STS REST interface #580

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

dtsybulka
Copy link

No description provided.

Copy link
Contributor

@ashakirin ashakirin left a comment

Choose a reason for hiding this comment

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

I like and support the idea to create STS Rest into separate module, because:

  • it makes start with Rest STS quickly and easier;
  • potentially helps to split Rest STS from SOAP overhead;
  • provides cleaner JAX-RS API for STS.

@reta
Copy link
Member

reta commented Nov 10, 2019

Thanks @dtsybulka, LGTM, @ashakirin anything you want to add / comment / change?

@coheigea
Copy link
Contributor

@reta, please hold off on the merge for a while, there are some things I need to check first with the PR.

@reta
Copy link
Member

reta commented Nov 12, 2019

@coheigea no objections, won't merge without your and @ashakirin approvals, thanks!

@dtsybulka
Copy link
Author

@coheigea could you please tell when you could check and review the PR? Thanks in advance.

@coheigea
Copy link
Contributor

@dtsybulka It's on my TODO list, but realistically it will be early in the new year before I can review it properly.

@dtsybulka
Copy link
Author

Hi @coheigea,
I hope you are fine. Could you please let me know if you had a chance to check the PR.
Best Regards,
Dmitry

@coheigea
Copy link
Contributor

Sorry, it'll be a few weeks before I can look at it, but it is on my radar for CXF 3.4.0.

Copy link
Contributor

@coheigea coheigea left a comment

Choose a reason for hiding this comment

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

I'm sorry for the very long delay in reviewing this PR. I'm happy to include it in CXF 3.4.0 if the changes I suggested are made. Do you have some time to address the changes in the near future?

@@ -69,7 +69,7 @@
public static final Map<String, String> DEFAULT_CLAIM_TYPE_MAP;
public static final Map<String, String> DEFAULT_TOKEN_TYPE_MAP;

private static final Map<String, String> DEFAULT_KEY_TYPE_MAP = new HashMap<>();
public static final Map<String, String> DEFAULT_KEY_TYPE_MAP = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

This map should be made an unmodifiable map as per the other public maps


<import resource="classpath:META-INF/cxf/cxf.xml"/>

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Change all instances of PropertyPlaceholderConfigurer to org.springframework.context.support.PropertySourcesPlaceholderConfigurer instead


@org.junit.AfterClass
public static void cleanup() throws Exception {
SecurityTestUtil.cleanup();
Copy link
Contributor

Choose a reason for hiding this comment

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

This method is removed in the latest codebase

validateJWTToken(token);
}

@org.junit.Ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these two tests Ignored?

/**
* Some tests for the REST interface of the CXF STS.
*/
public class STSRealmRestTest extends AbstractBusClientServerTestBase {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a huge amount of duplicated code between this class and STSRESTTest. I wonder if we can't abstract the tests to a common base class, and subclass just the bits that get the tokens?

description = "In case wrong configuration of RS security for requested realm")
}
)
JsonWebKeys getPublicVerificationKeys();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this method tested anywhere? I don't see it...

final Message message = getCurrentMessage();
final RequestSecurityTokenResponseType response = validateOperation.validate(
createValidateRequestSecurityTokenType(tokenString, "jwt"), null,
new WrappedMessageContext(message));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why WrappedMessageContext here? We can just pass through "message" and then eliminate the jaxws frontend from the pom.

import static org.apache.cxf.jaxrs.utils.HttpUtils.getProtocolHeader;
import static org.apache.cxf.message.Message.HTTP_REQUEST_METHOD;
import static org.apache.cxf.message.Message.PROTOCOL_HEADERS;
import static org.springframework.util.CollectionUtils.isEmpty;
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace this with: org.apache.cxf.common.util.StringUtils.isEmpty

Comment on lines 39 to 41
org.springframework.ldap*;resolution:=optional,
net.sf.ehcache*;resolution:=optional;version="[2.5, 3.0.0)",
org.opensaml*;version="${cxf.opensaml.osgi.version.range}",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these three lines can be removed.

* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cxf.sts.rest.api;
Copy link
Contributor

Choose a reason for hiding this comment

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

The package name of "org.apache.cxf.sts.rest" is a bit problematic in OSGi, as it clashes with the module in STS Core. Can we rename this to something different?

Choose a reason for hiding this comment

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

Is org.apache.cxf.sts.rs will be OK?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I guess so

@coheigea
Copy link
Contributor

Also, there is a merge conflict with CustomParameterTest.

� Conflicts:
�	services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomParameterTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants