Difference between security-realm and security-domain in WildFly - jboss

What is the main difference between security-domain and security-realm in WildFly?
standalone.xml
<security-domain name="foo">
<authentication>
<login-module code="..." flag="...">
</login-module>
</authentication>
</security-domain>
and
<security-realm name="foo">
<authentication>
<local default-user="..." allowed-users="..."
skip-group-loading="..."/>
<properties path="..." relative-to="..."/>
</authentication>
<authorization>
<properties path="..." relative-to="..."/>
</authorization>
</security-realm>

Answer updated (2018-06-08) to reflect WildFly Elytron naming. WildFly Elytron is a new security subsystem introduced in WildFly 11 (and JBoss EAP 7.1). Both security subsystems - legacy one and the Elytron - have notion of security domains and security realms but the meaning is different.
Legacy security
The Security Domains are used mainly for defining security of deployed applications.
The standard authentication in security domains is based on JAAS javax.security.auth.spi.LoginModule implementations. Application can come up with custom login module(s).
The Security Realms are used mainly for configuration security of server management interfaces and remoting.
The realm authentication is based on provided implementations of javax.security.auth.callback.CallbackHandler. AFAIK it's not possible to provide own CallbackHandler implementation.
A security domain can delegate authentication to a security realm by using the "RealmDirect" login module.
A security realm can delegate authentication to a security domain by using "jaas" authentication configuration
See also this response by JBoss security developer Darran Lofthouse.
Elytron security
The Security Realms encapsulate access to user repositories (DB - jdbc-realm, LDAP - ldap-realm, property file - properties-realm, ...). Compared to legacy security it's on a similar level as JAAS Login Modules. An API is provided so custom realms can be implemented.
The Security Domain represents a security policy which uses Security Realms for authentication. Security domains can be used in management security as well as in the application security. A successful authentication against a security domain produces a SecurityIdentity which represents the current user.
Read Elytron subsystem chapter in JBoss EAP documentation to get a more detailed overview of Elytron components.
To learn more about controlling authentication flow in Elytron security domains read this article from Darran Lofthouse.
In the middle between Legacy and Elytron security
If you are migrating from Legacy to Elytron security, you can expose a Legacy Security Domain as an Elytron Security Realm. Read more about this scenario in the Elytron Subsystem Migration guide

Related

How to enable single sign-on across different applications deployed in the same WildFly server

I have multiple applications deployed to a single WildFly server, version 26.1.2. Those applications have the same application security domain specified in their jboss-web.xml files.
Chapter Web Single Sign-On of WildFly Elytron Security explains how to enable single sign-on across different applications deployed into different servers, where these applications belong to same security domain.
I guess there must be an easier way to do this when all applications are running on the same server. I will appreciate any help you can provide on this matter.
This is the jboss-web file of application xyz2ap112-web:
<jboss-web>
<context-root>/xyz2ap112-web</context-root>
<resource-ref>
<res-ref-name>jdbc/xyz2db112</res-ref-name> <!-- Logical name only. -->
<jndi-name>java:/jdbc/xyz2db112</jndi-name> <!-- Real JNDI name. -->
</resource-ref>
<security-domain>xyz2ap112-web-security-domain</security-domain>
</jboss-web>
Actually the applications also share the same database, so the only difference between their jboss-web.xml files is the context root.
This is the login configuration for all the applications in their web.xml file:
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/faces/login.xhtml</form-login-page>
<form-error-page>/faces/error.xhtml</form-error-page>
</form-login-config>
<realm-name>xyz2ap112-web-security-domain</realm-name>
</login-config>
This is the definition of the application security domain in the standalone-full.xml file:
<application-security-domain name="xyz2ap112-web-security-domain" security-domain="xyz2db112-jdbc-security-domain"/>
This is the definition of the security domain in the standalone-full.xml file:
<security-domain name="xyz2db112-jdbc-security-domain" default-realm="xyz2db112-jdbc-realm" permission-mapper="default-permission-mapper">
<realm name="xyz2db112-jdbc-realm" role-decoder="groups-to-roles"/>
</security-domain>

How to integrate existing Auth Service with kibana and opendistro for authenticating users

We have our own authentication server developed in NodeJs, which acts as identity provider for users. So We are looking for how we can integrate it with Kibana-opendistro.
The security responsibility lies with the security plugin, so most of the configuration should be made there.
Opendistro Security provides support for a couple of authentication backends that you can refer here https://opensearch.org/docs/latest/security-plugin/configuration/configuration/. You can configure the security plugin based on the authentication mechanism used.
Alternatively, there is this concept of injected user where the authentication is completely handled by another service fronting the security plugin. Though I did not find documentation on this, you can refer to the code here https://github.com/opensearch-project/security/blob/565f47e804ec03aeeba02ca8def563b91307fcc7/src/test/java/org/opensearch/security/test/plugin/UserInjectorPlugin.java

Authenticate jBPM through the Identity gateway

I am using jBPM standalone to create workflows. By default, login is performed using the users.properties file.
I have an Identity server (created in Dot Net IdentityServer4 implementing OpenId) running and I registered a client (Ex: JBPM_CLIENT) and have the details (Scope, SecretKeys, etc..)
I am trying to redirect the authentication of jBPM through that Identity gateway.
While reading the documentation I thought KeyCloak can be used for this requirement.
But, when I see the KeyCloak GUI and configuration, it looks like KeyCloak something like IdentityServer4 and is useful to create an Identity Server instance.
My doubt is whether I can use KeyCloak as a client to connect to IdentityServer4?
Please suggest me a route.
Keycloak can act as an identity broker and it supports OIDC (OpenID Connect) identity providers. Using that capability, first configure your IdentityServer4 as the OIDC provider on Keycloak. Keycloak's documentation covers these details.
Once that's set, you can configure jBPM to use Keycloak client adapter for Wildfly and then create a suitable Keycloak client under the same realm where you had configured the OIDC identity provider. Details related to that are covered in this blog (outdated though).

WS Federation: Is SSO apart of the WS Federation specification?

When using a passive client (say web browser) and are using WS Federation with an STS such as ADFS, SSO is achieved to the relying parties. Is this apart of the WS Federation specification (that is, when using passive clients SSO will be achieved with WS Federation) or is this an implementation detail of ADFS (that is, ADFS sets a cookie so you only need to authenticate to ADFS once.. just beacuse the Microsoft developers thought it would improve user experience)?
It is a standard which is also supported by many other products.
https://en.wikipedia.org/wiki/WS-Federation_Passive_Requestor_Profile
http://janbernhardt.blogspot.com/2014/12/understanding-ws-federation-passive.html
WS-Federation Passive Requestor Profile is a Web Services specification - intended to work with the WS-Federation specification - which defines how identity, authentication and authorization mechanisms work across trust realms. The specification deals specifically with how applications, such as web browsers, make requests using these mechanisms. In this context, the web-browser is known as a "passive requestor." By way of contrast, WS-Federation Active Requestor Profile deals with "active requestors" such as SOAP-enabled applications. WS-Federation Passive Requestor Profile was created by IBM, BEA Systems, Microsoft, VeriSign, and RSA Security.[1]

Thinktecture Identity Server v/s WSO2 Identity Server

Am trying to choose between Thinktecture Identity Server v3 and Wso2 identity server for implementing Identity and Access Management solution.
Particularly, am interested in using following features:
Single Sign-On (SSO)
Managing user identities
Connecting to central repository like Active Directory, OpenLdap, Oracle Internet Directory etc.
Active and Passive Federation
Integration with ADFS
We are a .Net based shop, so getting more inclined to Thinktecture's IS, but don't want to rule out WSO2 just because its Java (one more dependency for us)
Are there other Pros/Cons between the two?
Thanks
I'm one of the developer of WSO2 Identity server. So my answer would biased to our product :)
WSO2IS is comprehensive Identity Management platform - having support for SAML2, OpenID, XACML 3.0, OAuth 2.0, OpenID Connect, SCIM, WS-Security standards.
And it acts as an Enterprise Identity Bus (EIB) — a central backbone to connect and manage multiple identities regardless of the standards on which they are based (http://blog.facilelogin.com/2014/10/identity-federation-patterns-with-wso2.html).
Few unique features that I would like to highlight on WSO2 Identity Server are.
SSO bridging to make identity and entitlement management effortless.
Identity Federation with EIB concept.(http://blog.facilelogin.com/2014/10/wso2-identity-server-microsoft-adfs.html)
Seamless integration between internal applications and cloud apps
such as Salesforce, Google Apps, and Microsoft Office 365.
New user and group provisioning capabilities
(http://blog.facilelogin.com/2014/10/wso2-identity-server-500-provisioning.html)
Multi-option and multi-step authentication to provide flexibility in
selecting authentication options and enable robust multi-factor
authentication
(http://blog.facilelogin.com/2014/10/what-is-new-in-wso2-identity-server-500.html)
High scalability (We have a middle-east customer using WSO2 IS over
an user base of 4 million for OpenID support.)
Light-weight and Very low memory footprint. The stripped down
version of WSO2 IS can be started with 64MB Heap Size and the
standard versions runs with 96MB Heap.
Highly extensible. The architecture behind WSO2 IS is highly
extensible. You can easily plugin your authenticators, user store,
provisioning connectors etc...
Support for multi-tenancy.
Suport for multiple user stores (AD, LDAP, JDBC)
Interoperability.
Part of a proven SOA product platform provided by WSO2.