directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r263848 - /directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/ErrorMessageHandler.java
Date Sun, 28 Aug 2005 09:30:22 GMT
Author: erodriguez
Date: Sun Aug 28 02:30:19 2005
New Revision: 263848

URL: http://svn.apache.org/viewcvs?rev=263848&view=rev
Log:
Base class to aid in error handling in Kerberos processing chains.  Used by AS, TGS, and Changepw
services.

Added:
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/ErrorMessageHandler.java
  (with props)

Added: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/ErrorMessageHandler.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/ErrorMessageHandler.java?rev=263848&view=auto
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/ErrorMessageHandler.java
(added)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/ErrorMessageHandler.java
Sun Aug 28 02:30:19 2005
@@ -0,0 +1,53 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   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 org.apache.kerberos.service;
+
+import javax.security.auth.kerberos.KerberosPrincipal;
+
+import org.apache.kerberos.chain.Filter;
+import org.apache.kerberos.chain.impl.CommandBase;
+import org.apache.kerberos.exceptions.KerberosException;
+import org.apache.kerberos.messages.ErrorMessage;
+import org.apache.kerberos.messages.ErrorMessageModifier;
+import org.apache.kerberos.messages.value.KerberosTime;
+
+/**
+ * A {@link CommandBase} for helping convert a {@link KerberosException} into
+ * an {@link ErrorMessage} to be returned to clients.  Used by the KDC Authentication
+ * Service, Ticket Granting Service, and the Change Password Service.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class ErrorMessageHandler extends CommandBase implements Filter
+{
+    public ErrorMessage getErrorMessage( KerberosPrincipal principal, KerberosException exception
)
+    {
+        ErrorMessageModifier modifier = new ErrorMessageModifier();
+
+        KerberosTime now = new KerberosTime();
+
+        modifier.setErrorCode( exception.getErrorCode() );
+        modifier.setExplanatoryText( exception.getMessage() );
+        modifier.setServerPrincipal( principal );
+        modifier.setServerTime( now );
+        modifier.setServerMicroSecond( 0 );
+        modifier.setExplanatoryData( exception.getExplanatoryData() );
+
+        return modifier.getErrorMessage();
+    }
+}

Propchange: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/ErrorMessageHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message