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

[ELY-179] Initial implementation (JACC-based authorization) #138

Merged
merged 1 commit into from Sep 24, 2015

Conversation

pedroigor
Copy link
Contributor

References

Overview

Provides an implementation of the JSR-115, Java Authorization Contract for Containers (JACC).

Backward Compatibility in WildFly

These changes were tested to check backward compatibility with the existing support provided by PicketBox in WildFly. Testes were executed based on:

  • Wildfly 10.0.0.Beta1-SNAPSHOT (latest upstream)
  • TCK 7
  • JavaEE 7 Samples
  • Existing integration tests in WildFly test suite

@wildfly-ci
Copy link

Linux Build 343 is now running using a merge of c5fc4f0

@wildfly-ci
Copy link

Windows Build 349 is now running using a merge of c5fc4f0

@wildfly-ci
Copy link

Linux Build 343 outcome was SUCCESS using a merge of b1e59e9
Summary: Tests passed: 486, ignored: 3 Build time: 0:01:09

@wildfly-ci
Copy link

Windows Build 349 outcome was SUCCESS using a merge of b1e59e9
Summary: Tests passed: 486, ignored: 3 Build time: 0:01:27

@wildfly-ci
Copy link

Linux Build 344 is now running using a merge of b1e59e9

@wildfly-ci
Copy link

Windows Build 350 is now running using a merge of b1e59e9

@wildfly-ci
Copy link

Linux Build 344 outcome was SUCCESS using a merge of b1e59e9
Summary: Tests passed: 486, ignored: 3 Build time: 0:01:10

@wildfly-ci
Copy link

Windows Build 350 outcome was SUCCESS using a merge of b1e59e9
Summary: Tests passed: 486, ignored: 3 Build time: 0:01:26

}

try {
ElytronPolicyConfigurationFactory policyConfigurationFactory = (ElytronPolicyConfigurationFactory) PolicyConfigurationFactory.getPolicyConfigurationFactory();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this maybe not be static/global? Would this prevent (for example) two WildFly EE containers from running within the same JVM?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. However, a JACC PolicyConfigurationFactory is actually static/global, created only once. Also, this is pretty much what we have today in WFLY, so it may not be an issue at all.

But I think we can better support two or more WFLY EE containers in the same JVM if we define a format to the contextID in order to avoid collisions and keep uniqueness. Need to check, but I think this is already done by WFLY when deploying modules ...

Copy link
Contributor

Choose a reason for hiding this comment

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

What we have today is one of the many things which prevents us from embedding properly. I am quite firm that I want to reduce or eliminate any global realizations of container-specific things, so if there's any logical way to make this context-aware then we should be doing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, that method is no longer static/global.

Like I said, the whole problem to make this context-aware is that PolicyConfigurationFactory is static and global. So, if you are sharing the same ClassLoader in different WFLY EE instances in the same JVM, you'll always get the same instance. However, I suppose that two WFLY EE containers in the same JVM will not share the same ClassLoader, right ?

Another possible solution when sharing the same instance of PolicyConfigurationFactory between different WFLY EE containers running in the same JVM is to define a format to the contextID, so we can append the container's identifier to the contextID to avoid collisions and keep uniqueness.

@dmlloyd dmlloyd added the hold label Apr 24, 2015
@dmlloyd
Copy link
Contributor

dmlloyd commented Apr 24, 2015

There's some discussion to be had here so I'm marking this "hold" for now.

@wildfly-ci
Copy link

Windows Build 351 is now running using a merge of c01affd

@wildfly-ci
Copy link

Linux Build 345 is now running using a merge of c01affd

@wildfly-ci
Copy link

Linux Build 345 outcome was SUCCESS using a merge of c01affd
Summary: Tests passed: 486, ignored: 3 Build time: 0:01:10

@wildfly-ci
Copy link

Windows Build 351 outcome was SUCCESS using a merge of c01affd
Summary: Tests passed: 486, ignored: 3 Build time: 0:01:26

@wildfly-ci
Copy link

Windows Build 352 is now running using a merge of 19ac0dd

@wildfly-ci
Copy link

Linux Build 346 is now running using a merge of 19ac0dd

@wildfly-ci
Copy link

Linux Build 346 outcome was SUCCESS using a merge of 19ac0dd
Summary: Tests passed: 486, ignored: 3 Build time: 0:01:14

@wildfly-ci
Copy link

Windows Build 352 outcome was SUCCESS using a merge of 19ac0dd
Summary: Tests passed: 486, ignored: 3 Build time: 0:01:26

String contextID;

if (WildFlySecurityManager.isChecking()) {
contextID = doPrivileged(new GetContextIDAction());
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this action appears to be stateless, it should probably be constant as well, or better yet just use a method reference to PolicyContext::getContextID() instead of an action object.

@wildfly-ci
Copy link

Linux Build 714 is now running using a merge of 5de372a

@wildfly-ci
Copy link

Linux Build 714 outcome was SUCCESS using a merge of 5de372a
Summary: Tests passed: 607, ignored: 4 Build time: 00:01:54

@wildfly-ci
Copy link

Windows Build 720 outcome was SUCCESS using a merge of 5de372a
Summary: Tests passed: 607, ignored: 4 Build time: 00:02:24

@pedroigor
Copy link
Contributor Author

Rebased.

@wildfly-ci
Copy link

Linux Build 726 is now running using a merge of 4189f75

@wildfly-ci
Copy link

Windows Build 732 is now running using a merge of 4189f75

@wildfly-ci
Copy link

Linux Build 726 outcome was SUCCESS using a merge of 4189f75
Summary: Tests passed: 609, ignored: 4 Build time: 00:02:03

@wildfly-ci
Copy link

Windows Build 732 outcome was SUCCESS using a merge of 4189f75
Summary: Tests passed: 609, ignored: 4 Build time: 00:02:29

@@ -48,7 +48,7 @@
PermissionCollection mapPermissions(Principal principal, Set<String> roles);

/**
* A default implementation that does nothing but returns an empty and read-only {@link PermissionCollection}.
* A default implementation that does nothing but returns an empty and read-only {@link Policy#UNSUPPORTED_EMPTY_COLLECTION}.
Copy link
Contributor

Choose a reason for hiding this comment

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

This change in specification is probably not warranted or desired - if this policy becomes problematic, we may have to replace it with a different empty one.

@dmlloyd
Copy link
Contributor

dmlloyd commented Sep 2, 2015

Otherwise seems OK to me. There are still some static globals that IMO should be changed but we can deal with that later.

@pedroigor pedroigor force-pushed the ELY-179 branch 2 times, most recently from 5614467 to 9b73137 Compare September 8, 2015 20:23
checkNotNullParam("link", link);
checkIfInOpenState();

synchronized (this.linkedPolicies) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This however is not fine. You're synchronizing on the collection that the field points to, but you're updating that same field inside the block. Thus anyone reading the field may get an outdated copy.

@pedroigor pedroigor force-pushed the ELY-179 branch 2 times, most recently from 0deb183 to 8bb84f7 Compare September 8, 2015 21:16
@dmlloyd dmlloyd added the +1 DML label Sep 8, 2015
@dmlloyd
Copy link
Contributor

dmlloyd commented Sep 8, 2015

Seems OK to start with.

@darranl darranl added the +1 DAL label Sep 24, 2015
darranl added a commit that referenced this pull request Sep 24, 2015
[ELY-179] Initial implementation (JACC-based authorization)
@darranl darranl merged commit 67ce1c7 into wildfly-security:master Sep 24, 2015
@pedroigor pedroigor deleted the ELY-179 branch November 22, 2016 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants